diff --git a/crates/nu-cmd-lang/src/core_commands/do_.rs b/crates/nu-cmd-lang/src/core_commands/do_.rs index fe788983da..db0617db3b 100644 --- a/crates/nu-cmd-lang/src/core_commands/do_.rs +++ b/crates/nu-cmd-lang/src/core_commands/do_.rs @@ -31,16 +31,6 @@ impl Command for Do { "ignore errors as the closure runs", Some('i'), ) - .switch( - "ignore-shell-errors", - "ignore shell errors as the closure runs", - Some('s'), - ) - .switch( - "ignore-program-errors", - "ignore external program errors as the closure runs", - Some('p'), - ) .switch( "capture-errors", "catch errors as the closure runs, and return them", @@ -71,36 +61,6 @@ impl Command for Do { let rest: Vec = call.rest(engine_state, caller_stack, 1)?; let ignore_all_errors = call.has_flag(engine_state, caller_stack, "ignore-errors")?; - if call.has_flag(engine_state, caller_stack, "ignore-shell-errors")? { - nu_protocol::report_shell_warning( - engine_state, - &ShellError::GenericError { - error: "Deprecated option".into(), - msg: "`--ignore-shell-errors` is deprecated and will be removed in 0.102.0." - .into(), - span: Some(call.head), - help: Some("Please use the `--ignore-errors(-i)`".into()), - inner: vec![], - }, - ); - } - if call.has_flag(engine_state, caller_stack, "ignore-program-errors")? { - nu_protocol::report_shell_warning( - engine_state, - &ShellError::GenericError { - error: "Deprecated option".into(), - msg: "`--ignore-program-errors` is deprecated and will be removed in 0.102.0." - .into(), - span: Some(call.head), - help: Some("Please use the `--ignore-errors(-i)`".into()), - inner: vec![], - }, - ); - } - let ignore_shell_errors = ignore_all_errors - || call.has_flag(engine_state, caller_stack, "ignore-shell-errors")?; - let ignore_program_errors = ignore_all_errors - || call.has_flag(engine_state, caller_stack, "ignore-program-errors")?; let capture_errors = call.has_flag(engine_state, caller_stack, "capture-errors")?; let has_env = call.has_flag(engine_state, caller_stack, "env")?; @@ -206,7 +166,7 @@ impl Command for Do { } } Ok(PipelineData::ByteStream(mut stream, metadata)) - if ignore_program_errors + if ignore_all_errors && !matches!( caller_stack.stdout(), OutDest::Pipe | OutDest::PipeSeparate | OutDest::Value @@ -218,10 +178,10 @@ impl Command for Do { } Ok(PipelineData::ByteStream(stream, metadata)) } - Ok(PipelineData::Value(Value::Error { .. }, ..)) | Err(_) if ignore_shell_errors => { + Ok(PipelineData::Value(Value::Error { .. }, ..)) | Err(_) if ignore_all_errors => { Ok(PipelineData::empty()) } - Ok(PipelineData::ListStream(stream, metadata)) if ignore_shell_errors => { + Ok(PipelineData::ListStream(stream, metadata)) if ignore_all_errors => { let stream = stream.map(move |value| { if let Value::Error { .. } = value { Value::nothing(head) diff --git a/crates/nu-command/tests/commands/do_.rs b/crates/nu-command/tests/commands/do_.rs index 1a2258cf9c..606c534073 100644 --- a/crates/nu-command/tests/commands/do_.rs +++ b/crates/nu-command/tests/commands/do_.rs @@ -40,22 +40,6 @@ fn do_with_semicolon_break_on_failed_external() { assert_eq!(actual.out, ""); } -#[test] -fn ignore_shell_errors_works_for_external_with_semicolon() { - let actual = nu!(r#"do -s { open asdfasdf.txt }; "text""#); - - assert!(actual.err.contains("Deprecated option")); - assert_eq!(actual.out, "text"); -} - -#[test] -fn ignore_program_errors_works_for_external_with_semicolon() { - let actual = nu!(r#"do -p { nu -n -c 'exit 1' }; "text""#); - - assert!(actual.err.contains("Deprecated option")); - assert_eq!(actual.out, "text"); -} - #[test] fn ignore_error_should_work_for_external_command() { let actual = nu!(r#"do -i { nu --testbin fail asdf }; echo post"#); @@ -76,11 +60,3 @@ fn run_closure_with_it_using() { assert!(actual.err.is_empty()); assert_eq!(actual.out, "3"); } - -#[test] -fn waits_for_external() { - let actual = nu!(r#"do -p { nu -c 'sleep 1sec; print before; exit 1'}; print after"#); - - assert!(actual.err.contains("Deprecated option")); - assert_eq!(actual.out, "beforeafter"); -}