-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Is the special case for exit code 2 necessary? (JSHint integration) #627
Comments
In case anyone lands here with the same problem my simple workaround for now is to call nodemon like this:
|
this is what node document as its exit codes: https://github.com/nodejs/node-v0.x-archive/blob/master/doc/api/process.markdown#exit-codes |
Okay, I think it makes more sense to change nodemon rather than hope for a breaking change to update in jshint. I can't remember exactly why I added this code, but I was being intentional. Do we think the entire condition should be removed based on the exit codes from node's docs? |
Well, it seems you do get warning 2 when its a bad command, but you can get error code 2 from any app for a variety of different reasons - I don't think you can assume its a bad command. Maybe log a warning? or add an option for fatalErrorCode? Probably both nodemon should be more accepting or error code 2 and jshint shouldn't use it. |
Seems that Mocha also throws error code 2. +1 for Nodemon accepting it as a normal failure. |
I'd love to see this fixed as well. Mocha exits with code 2 when there are 2 errors (code 3 for 3 errors, etc.). That mocha "feature" defeats nodemon from continually watching and re-running the tests as I fix them. |
This issue has been automatically marked as idle and stale because it hasn't had any recent activity. It will be automtically closed if no further activity occurs. If you think this is wrong, or the problem still persists, just pop a reply in the comments and @remy will (try!) to follow up. |
Imo, this is still a problem. Unless this is an explicit "won't fix" from the devs, this should remain open. |
@remy, you already suggested to remove that condition. Is there anything deterring you from doing that? The change is minimal (I can submit a PR if that's the issue) but I understand it supposes introducing a breaking change (thus, requiring a new major version). |
In case anyone else arrives here in 2018 onwards, it's still an issue with Mocha. The two solutions proposed that change the error code both work: mocha || true or: mocha || exit 1 Perhaps a command-line option to tell (Sorry I don't have time to do a PR at the moment, but perhaps in a month or so!) |
Only exit after code 2 if it happened quickly; improve messaging (recommend `||exit 1`) If nodemon exits _quickly_ on code 2, then it'll bail and warn. If it's after ~500ms, then it assumes that the sub-process intentionally used exit 2 (like mocha or stylelint), it won't bail and treat it as a failure (like a crash). Props to @joeytwiddle Fixes #496 Fixes #627
I followed the thread here - remy/nodemon#627 (comment)
This seems to pose a problem when you also want Python libraries return an exit code 2 sometimes, and right now I have a command like this in scripts: {
"parse-reload": "nodemon --exec 'python -m parse || exit 1' --"
} This allows me to If I omit the So I add the I think this could easily be solved if |
This is still an issue when using nodemon with The workaround works, so I'm not complaining, but just my 2 cents. |
I see that exit code 2 has special meaning for bash (http://tldp.org/LDP/abs/html/exitcodes.html) however I am trying to use nodemon with JSHint. Unfortunately JSHint uses exit code 2 to signal that there are lint errors so nodemon exits the first time I forget a semi-colon with the following error.
I can't actually see any reason nodemon should exit in this case, whether JSHint should be using that exit code or not
I have raised a corresponding issue at jshint/jshint#2672
The text was updated successfully, but these errors were encountered: