From 82c806c7af352a4be2b94039bad5d76cff555360 Mon Sep 17 00:00:00 2001 From: Xavier L'Heureux <xavier.lheureux@icloud.com> Date: Sun, 30 Jun 2019 09:52:09 -0400 Subject: [PATCH] Don't set a new pgrp if the terminal already controls the tty --- src/main.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/main.rs b/src/main.rs index 7328eb38..e4cfded6 100644 --- a/src/main.rs +++ b/src/main.rs @@ -132,6 +132,9 @@ fn parse_args() -> CommandLineArgs { fn set_unique_pid() -> nix::Result<()> { let pgid = unistd::getpid(); + if pgid == unistd::tcgetpgrp(nix::libc::STDIN_FILENO)? { + return Ok(()); + } unistd::setpgid(pgid, pgid)?; unsafe { signal::signal(Signal::SIGTTOU, SigHandler::SigIgn) }?; unistd::tcsetpgrp(nix::libc::STDIN_FILENO, pgid) -- GitLab