From 46eec5e3a29ffb0fedc227c32b01f2264769ed3a Mon Sep 17 00:00:00 2001 From: Val Packett Date: Mon, 17 Oct 2022 22:08:25 +0300 Subject: [PATCH] Tolerate more tty acquisition failures in non-interactive mode, fixes #6719 (#6779) --- src/main.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/main.rs b/src/main.rs index 0c66e7ed02..389d21224d 100644 --- a/src/main.rs +++ b/src/main.rs @@ -97,13 +97,17 @@ fn take_control(interactive: bool) { _ => { // fish also has other heuristics than "too many attempts" for the orphan check, but they're optional if signal::killpg(Pid::from_raw(-shell_pgid.as_raw()), Signal::SIGTTIN).is_err() { + if !interactive { + // that's fine + return; + } eprintln!("ERROR: failed to SIGTTIN ourselves"); std::process::exit(1); } } } } - if !success { + if !success && interactive { eprintln!("ERROR: failed take control of the terminal, we might be orphaned"); std::process::exit(1); }