-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
[BUG] npm exit status should be indicative of the error #7109
Comments
That is not how exit codes work in linux et al. There are a few predefined linux exit codes already https://www.man7.org/linux/man-pages/man3/sysexits.h.3head.html. They are not the same as the windows exit codes https://learn.microsoft.com/en-us/windows/win32/debug/system-error-codes--0-499- Folks who need to log in should not have npm telling Windows that there is a |
Most cross-platorm apps stick to 1, 0, and -1 for exit codes for just this reason. |
I'm sorry, but those links refer to exit statuses from linux system processes and error codes from windows system function calls. There is no requirement nor stated expectation that non-system programs ought to or are expected to return the same. |
Is there an existing issue for this?
The only related issue I could find was #4724 however that is adjacent to this.
This issue exists in the latest npm version
Current Behavior
I maintain a GitHub action that publishes to npm, which occasionally encounters the error:
from the following code:
https://github.com/bevry-actions/npm/blob/3d7f43852ed3893954dfe3e788c17af03c08c404/action.bash#L50-L73
We can see that the error code is 409, however unfortunately to get this information programatically I would have to scan stderr. I believe instead of scanning stderr, npm should make the exit status the error code, in this case
409
, instead of just returning exit status1
.I understand this is more of a feature request, however there wasn't a template for that when creating this issue.
Expected Behavior
Exit status for error code 409 should be 409 instead of 1, to allow easy programatic identification (exit status are readily available via most programming languages that deal with CLI execution) whereas stderr scanning is more tedious.
Steps To Reproduce
To reproduce error 409, publish two updates to a package in quick succession, such as a preview release tag and a latest release.
Environment
The text was updated successfully, but these errors were encountered: