diff --git a/crates/nu-command/tests/commands/do_.rs b/crates/nu-command/tests/commands/do_.rs index fe7959acb45ef..bbce5648db3e3 100644 --- a/crates/nu-command/tests/commands/do_.rs +++ b/crates/nu-command/tests/commands/do_.rs @@ -9,25 +9,28 @@ fn capture_errors_works() { assert!(actual.err.contains("column_not_found")); } +// TODO: need to add tests under display_error.exit_code = true #[test] fn capture_errors_works_for_external() { let actual = nu!("do -c {nu --testbin fail}"); - assert!(actual.err.contains("exited with code")); - assert_eq!(actual.out, ""); + assert!(!actual.status.success()); + assert!(!actual.err.contains("exited with code")); } +// TODO: need to add tests under display_error.exit_code = true #[test] fn capture_errors_works_for_external_with_pipeline() { let actual = nu!("do -c {nu --testbin fail} | echo `text`"); - assert!(actual.err.contains("exited with code")); - assert_eq!(actual.out, ""); + assert!(!actual.status.success()); + assert!(!actual.err.contains("exited with code")); } +// TODO: need to add tests under display_error.exit_code = true #[test] fn capture_errors_works_for_external_with_semicolon() { let actual = nu!(r#"do -c {nu --testbin fail}; echo `text`"#); - assert!(actual.err.contains("exited with code")); - assert_eq!(actual.out, ""); + assert!(!actual.status.success()); + assert!(!actual.err.contains("exited with code")); } #[test] diff --git a/crates/nu-protocol/src/config/display_errors.rs b/crates/nu-protocol/src/config/display_errors.rs index 82b7a564151a6..45239deda9e30 100644 --- a/crates/nu-protocol/src/config/display_errors.rs +++ b/crates/nu-protocol/src/config/display_errors.rs @@ -22,7 +22,7 @@ impl DisplayErrors { impl Default for DisplayErrors { fn default() -> Self { Self { - exit_code: true, + exit_code: false, termination_signal: true, } } diff --git a/tests/shell/pipeline/commands/external.rs b/tests/shell/pipeline/commands/external.rs index 461cd1638b09b..d92785b51ce61 100644 --- a/tests/shell/pipeline/commands/external.rs +++ b/tests/shell/pipeline/commands/external.rs @@ -627,16 +627,18 @@ fn exit_code_stops_execution_closure() { assert!(actual.err.contains("exited with code 1")); } +// TODO: need to add tests under display_error.exit_code = true #[test] fn exit_code_stops_execution_custom_command() { let actual = nu!("def cmd [] { nu -c 'exit 42'; 'ok1' }; cmd; print 'ok2'"); assert!(actual.out.is_empty()); - assert!(actual.err.contains("exited with code 42")); + assert!(!actual.err.contains("exited with code 42")); } +// TODO: need to add tests under display_error.exit_code = true #[test] fn exit_code_stops_execution_for_loop() { let actual = nu!("for x in [0 1] { nu -c 'exit 42'; print $x }"); assert!(actual.out.is_empty()); - assert!(actual.err.contains("exited with code 42")); + assert!(!actual.err.contains("exited with code 42")); }