-
Notifications
You must be signed in to change notification settings - Fork 326
Fix Jekyll exit status for Travis #537
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
Conversation
820ecfa
to
c7ebd34
Compare
- bundle exec jekyll build | ||
- bundle exec jekyll build 2> error.log | ||
- cat >&2 error.log | ||
- grep -qie Error error.log && false || true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How should I read this line? Just from reading it it seems like:
true && false || true ==
(true && false) || true ==
false || true ==
true
and
false && false || true ==
(false && false) || true ==
false || true ==
true
So either way it will return true.
I fully admit I maybe missing something here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're right. (http://stackoverflow.com/questions/17203122/bash-if-else-statement-in-one-line#comment33428887_17203203)
I recommend instead using:
[ "$(grep -cie Error error.log)" -eq 0 ]
Agreed, it might not be obvious right away what this means in shell: grep -qie Error error.log && false || true This would be the simplest thing: ! grep -qie Error error.log Less cryptic than the previous? I assume putting a bang there is supported by Travis, but I didn't check |
It is not really about being cryptic. It is about having the intended behavior. I don't think the two code snips do the same thing. I suspect that your second version will work. Are you interested in testing it out and updating the PR? You could play around with Travis on your fork and then when it all works you could push the changes into this PR. Thanks for your work on this. :-) |
4133c05
to
5d24ebb
Compare
You're right. Thanks for catching this. Looks like a bare exclamation point won't work, but I can use bang in parens: ( ! grep -qie Error error.log ) |
d8b75ec
to
5d24ebb
Compare
Introducing Seth's broken patch in 748c635 causes Travis to fail. |
Grep the output of Jekyll for errors since it returns zero exits with YAML errors. See jekyll issue 5257.
5d24ebb
to
b49dfb1
Compare
The errors are produced by the
|
@@ -16,4 +16,6 @@ install: | |||
- bundle install | |||
|
|||
script: | |||
- bundle exec jekyll build | |||
- bundle exec jekyll build 2> error.log | |||
- cat >&2 error.log |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Under what conditions will this line exit with a non-zero status?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess what I am getting at is I don't understand what the >&2
is for.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The 2>
pipes stderr to error.log
The >&2
pipes stdout to stderr
I guess what I am getting at is I don't understand what the >&2 is for.
It makes the font of the error message "Yellow" in Travis?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay >&2
is starting to make more sense.
But why cat >&2 error.log
instead of cat error.log >&2
.
Thanks for your time. I know your job is not to spend all day educating me. ;-)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, no difference. Let me know if >&2
at the end is clearer.
Thank you for the careful review!
wonderful! |
Grep the output of Jekyll for errors since it returns zero exits with
YAML errors. See jekyll/jekyll#5257.