diff --git a/crates/nu-cli/src/evaluate/evaluator.rs b/crates/nu-cli/src/evaluate/evaluator.rs index e3df8c8b0f..723226753c 100644 --- a/crates/nu-cli/src/evaluate/evaluator.rs +++ b/crates/nu-cli/src/evaluate/evaluator.rs @@ -198,6 +198,10 @@ async fn evaluate_invocation( let output = result.into_vec().await; + if let Some(e) = context.get_errors().get(0) { + return Err(e.clone()); + } + match output.len() { x if x > 1 => Ok(UntaggedValue::Table(output).into_value(Tag::unknown())), 1 => Ok(output[0].clone()), diff --git a/tests/shell/pipeline/commands/internal.rs b/tests/shell/pipeline/commands/internal.rs index 6067a22650..884467cee8 100644 --- a/tests/shell/pipeline/commands/internal.rs +++ b/tests/shell/pipeline/commands/internal.rs @@ -100,6 +100,16 @@ fn invocation_handles_dot() { }) } +#[test] +fn argument_invocation_reports_errors() { + let actual = nu!( + cwd: ".", + "echo $(ferris_is_not_here.exe)" + ); + + assert!(actual.err.contains("Command not found")); +} + #[test] fn can_process_one_row_from_internal_and_pipes_it_to_stdin_of_external() { let actual = nu!(