Tolerate more tty acquisition failures in non-interactive mode, fixes #6719 (#6779)

This commit is contained in:
Val Packett 2022-10-17 22:08:25 +03:00 committed by GitHub
parent 378248341e
commit 46eec5e3a2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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);
}