You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Second command is run when the first one fails #3858
According to the "Coming from Bash" documentation, passing "command1; command2" to nushell should result in running "command1" followed by running "command2" if the first one was successful.
It seems that currently this is only the case if the "nonzero_exit_errors" configuration value is true. The way I understand the documentation, this configuration value should only change whether the failure of the external command is run, and not whether the second command is run.
Apparently the current behavior was introduced in commit 3ae3e3d and probably caused by the fact that an UntaggedValue::nothing() is now sent instead of UntaggedValue::Error, but I am not familiar with the nushell code, so I am not sure about this.
To Reproduce
Make sure that the "nonzero_exit_errors" configuration is set to false
Run the command "false; echo foo"
The string "foo" is printed to the terminal
Expected behavior
I did not expect "foo" to be printed to the terminal
This issue is being marked stale because it has been open for 90 days without activity. If you feel that this is in error, please comment below and we will keep it marked as active. Otherwise, it will be closed in 10 days.
Wait, nonzero_exit_errors is not the default? I’m pretty sure I chose nu because it has this sensible behavior.
/edit: that config doesn’t seem to exist anymore. A sensible script should immediately exit with an error when an external command fails unless it’s wrapped in do -i {} or so.
Activity
[-]Second command is run when the frist one fails[/-][+]Second command is run when the first one fails[/+]github-actions commentedon Oct 27, 2021
This issue is being marked stale because it has been open for 90 days without activity. If you feel that this is in error, please comment below and we will keep it marked as active. Otherwise, it will be closed in 10 days.
fdncred commentedon Mar 12, 2022
still happens in 0.59.1
false; echo fooprints fooflying-sheep commentedon May 10, 2022
Wait,
nonzero_exit_errorsis not the default? I’m pretty sure I chose nu because it has this sensible behavior./edit: that config doesn’t seem to exist anymore. A sensible script should immediately exit with an error when an external command fails unless it’s wrapped in
do -i {}or so.sholderbach commentedon Dec 1, 2022
I think this should be resolved now. Any specific bugs that might still occur should be addressed in newer issues.
flying-sheep commentedon Feb 13, 2023
OK, so this issue is about
working as expected, and #5347 and #3585 are about external commands?
Alex-EEE commentedon Apr 3, 2023
Wait, this is insane and incorrect!!!!! In Bash, the second command ALWAYS runs after ;
If you want the behavior you're describing, then in Bash you use cmd_fails && dont_run
So basically, this WAS working correctly, and now you guys have broken. Reopen and fix please!!!!