Commit 68c6a072 authored by AdminXVII's avatar AdminXVII Committed by AdminXVII

Use a finer-grained approach to setting the terminal leader

parent a95c0e38
......@@ -133,12 +133,14 @@ fn parse_args() -> CommandLineArgs {
fn set_unique_pid() -> nix::Result<()> {
let pgid = unistd::getpid();
if pgid == unistd::tcgetpgrp(nix::libc::STDIN_FILENO)? {
return Ok(());
if pgid != unistd::getpgrp() {
unistd::setpgid(pgid, pgid)?;
}
unistd::setpgid(pgid, pgid)?;
unsafe { signal::signal(Signal::SIGTTOU, SigHandler::SigIgn) }?;
unistd::tcsetpgrp(nix::libc::STDIN_FILENO, pgid)
if pgid != unistd::tcgetpgrp(nix::libc::STDIN_FILENO)? {
unsafe { signal::signal(Signal::SIGTTOU, SigHandler::SigIgn) }?;
unistd::tcsetpgrp(nix::libc::STDIN_FILENO, pgid)?;
}
Ok(())
}
fn main() {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment