-
Notifications
You must be signed in to change notification settings - Fork 3.3k
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 outdated exit code should not be set with json output #3844
Comments
Why not? |
See #1109 |
I did try to replicate this and |
This may not be a problem, this PR is where we can find out |
To me it seems identically a problem - or not a problem - regardless of the output format. It will be very surprising to me if changing the output format has ANY impact on the exit code; the two are not semantically related. |
Perhaps @boostvolt can elaborate on how what is in place is broken? |
I can confirm that this is not the current behavior, and I agree it shouldn't be. It might have been in the past, if I'm reading #1109 correctly? I would consider #1109 still resolved, since we now output I think it's worth noting that there were other requests in #1109 to never have |
I have no opinion on whether outdated sets the exit code or not, altho i can see the argument for both. I have a strong opinion that the output format should never dictate the exit code. |
When I use |
I'm not able to reproduce that behavior. I see the only output printed to stdout and the only difference being the exit code set by the command. Here's what I'm getting in
$ npm --version
7.24.1
$ npm outdated --json 2> /dev/null; echo "code: $?"
{
"@npmcli/arborist": {
"current": "3.0.0",
"wanted": "2.10.0",
"latest": "3.0.0",
"dependent": "3844",
"location": "/Users/lukekarrys/Desktop/npm-sandbox/3844/node_modules/@npmcli/arborist"
}
}
code: 0
$ npm outdated 2> /dev/null; echo "code: $?"
Package Current Wanted Latest Location Depended by
@npmcli/arborist 3.0.0 2.10.0 3.0.0 node_modules/@npmcli/arborist 3844
code: 0
$ npm --version
7.24.2
$ npm outdated --json 2> /dev/null; echo "code: $?"
{
"@npmcli/arborist": {
"current": "3.0.0",
"wanted": "2.10.0",
"latest": "3.0.0",
"dependent": "3844",
"location": "/Users/lukekarrys/Desktop/npm-sandbox/3844/node_modules/@npmcli/arborist"
}
}
code: 1
$ npm outdated 2> /dev/null; echo "code: $?"
Package Current Wanted Latest Location Depended by
@npmcli/arborist 3.0.0 2.10.0 3.0.0 node_modules/@npmcli/arborist 3844
code: 1 |
I just tried this out as well. If I run the command in the terminal everything works. As soon as I call it as Node.js child process I get the exit code 1 error message. |
@boostvolt thanks for the follow up information. As I mentioned in #3871 (comment), this is working as intended right now, so an RFC issue with some details on how this should be changed is the best way forward. |
Is there an existing issue for this?
Current Behavior
See #1109
Fix will be.
Expected Behavior
No response
Steps To Reproduce
No response
Environment
The text was updated successfully, but these errors were encountered: