fix exit code (#5835)

* fix exit code

* fix usage

* add comment
This commit is contained in:
WindSoilder
2022-06-20 22:05:11 +08:00
committed by GitHub
parent dbcfcdae89
commit fab3f8fd40
4 changed files with 33 additions and 7 deletions

View File

@ -287,6 +287,8 @@ mod external_words {
}
mod nu_commands {
use nu_test_support::playground::Playground;
use super::nu;
#[test]
@ -298,6 +300,18 @@ mod nu_commands {
assert_eq!(actual.out, "foo");
}
#[test]
fn failed_with_proper_exit_code() {
Playground::setup("external failed", |dirs, _sandbox| {
let actual = nu!(cwd: dirs.test(), r#"
nu -c "cargo build; print $env.LAST_EXIT_CODE"
"#);
// cargo for non rust project's exit code is 101.
assert_eq!(actual.out, "101")
})
}
#[test]
fn better_arg_quoting() {
let actual = nu!(cwd: ".", r#"