-
Notifications
You must be signed in to change notification settings - Fork 132
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
fix: bail if purs exits non-ok #1285
Conversation
|
hmm maybe dying isn't the right thing to do? |
Uh, it looks like this uncovered a funny bug - CI is failing on this test, which should have never passed in the first place because we are supposed to fail in that condition |
src/Spago/Psa.purs
Outdated
logSuccess "Build succeeded." | ||
pure true | ||
else if Array.all identity arrErrorsIsEmpty && not (Cmd.exitedOk result) then do |
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.
Having this code structured as a series of if/else makes it extra confusing, let's move it to a case
statement, e.g.
case Array.all identity arrErrorsIsEmpty, Cmd.exitedOk result of
-- No errors, and 0 exit code
true, true -> ...
-- No errors, but non-zero exit code, so something's up
true, false -> ...
-- Compilation errors, print them out
false, _ -> ...
Let's also try to catch the JSON decoding error earlier: the scenario we are trying to prevent here has err
being an empty string. So let's try to not print the warning if that's the case, hopefully it will reduce the log noise.
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.
ok no problem, ended up changing the output traversal to collect into an array of eithers to defer that logging and changed to a case expression
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.
Code looks good - could we add a test for this? The best way I can think of is to try to pass a nonexistent flag to purs.
Sorry forgot about this. Will do tomorrow! |
@cakekindel did you get around to finish this or shall I take care of the last bits? I'd like to get this merged ASAP before it gets out of date |
Sorry I forgot again, updated & added test!
|
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.
This is good, thanks! 👏
Let's see if I can merge with just applying the suggestion or if we need to fight CI any further
Is it still CRLF? No diff in log output 😕 |
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
add contrarian newlines to the long list of problems bill gates is responsible for cursing us with on this godforsaken hellscape we call Earth.
@cakekindel could I ask you to not force push? It makes it harder to follow the changeset over the history of the PR. |
Understood! I can definitely respect this, but also ask in return for patience / understanding as my instinct is not to prioritize a linear history on working branches. I may rebase onto upstream rather than merge by mistake. I usually don't force push amendments, not sure why i did that here
I saw this after I realized I was out of date but the test still failed for some reason. I'll revert my commits on top of yours and try to get your solution passing on windows, sorry 😔 |
Oh yeah no worries! It's not a hard rule, but using merge commits instead of rebasing makes it harder to lose content if I'm pushing to the same branch when trying to get things merged in 🙂 |
let | ||
renderNonPrinting = | ||
String.replaceAll (String.Pattern "\r") (String.Replacement "␍") | ||
>>> String.replaceAll (String.Pattern "\t") (String.Replacement "␉-->") | ||
in |
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.
If this is contentious i can undo, just thought it would be a good unobtrusive addition to catch failures early in CI
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.
Ah yeah, I like it! (for now, let's see how it fares over time 😂)
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.
OMG CI passes 🎉 thank you again @cakekindel for getting this over the finish line! ❤️
closes #1284
Description of the change
TODO
Checklist:
README
P.S.: the above checks are not compulsory to get a change merged, so you may skip them. However, taking care of them will result in less work for the maintainers and will be much appreciated 😊