New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
travis-build: preserving the status in $? #3771
Comments
Each line in the I understand the motivation for using I tend to think it is better to document this behavior, and advise writing a custom script if the user wants to do something involving |
I think anyone who's tried to use $? has come across this limitation and avoided it by writing a custom script (like I should be doing now). Thanks for the prompt response. |
I've noted this in http://docs.travis-ci.com/user/customizing-the-build/#Note-on-%24%3F. (Improvement suggestions welcome!) I'm closing this now. |
The trick is, you have to get it right after the command.
Though in my .travis.yml I usually just combine the command using "&&" or "||" bash operator or inside another
or
|
@BanzaiMan , while I'm still not convinced that there is a person using - COMPILE_RESULT=0 ; make -j4 || COMPILE_RESULT=$?; expr $COMPILE_RESULT != 0 - [ $COMPILE_RESULT -ge 2 ] && echo makefile error So the two objectives in deciding this structure where to make $COMPILE_RESULT have the value of the return and to give travis a true/false indicator of the result of the compile. @weitjong suggestions are of course valid (though export is excessive) however sometime additional flexibility is needed. |
Improvement to the documentation is also welcome! |
Thanks @weitjong |
Does Travis capture the non zero exit code for init scripts like |
The travis-ci build was not marked as failed even though the test script detected an error. The problem was the (otherwise normal) usage of the $? bash variable, that conflicts with the way travis-ci runs the script. See: travis-ci/travis-ci#3771
The travis-ci build was not marked as failed even though the test script detected an error. The problem was the (otherwise normal) usage of the $? bash variable, that conflicts with the way travis-ci runs the script. See: travis-ci/travis-ci#3771
I ran into travis-ci/travis-ci#3771. Use of $? is dicouraged in .travis.yml, therefore building PyTorch has been externalized to a script. Not sure whether travis_wait works within the script or needs to be pulled back up to .travis.yml.
Whether make succeeds or fails $? is always 1.
output:
The text was updated successfully, but these errors were encountered: