Skip to content
Snippets Groups Projects
Commit 68c6a072 authored by AdminXVII's avatar AdminXVII Committed by AdminXVII
Browse files

Use a finer-grained approach to setting the terminal leader

parent a95c0e38
No related branches found
No related tags found
1 merge request!1100Use a finer-grained approach to setting the terminal leader
...@@ -133,12 +133,14 @@ fn parse_args() -> CommandLineArgs { ...@@ -133,12 +133,14 @@ fn parse_args() -> CommandLineArgs {
fn set_unique_pid() -> nix::Result<()> { fn set_unique_pid() -> nix::Result<()> {
let pgid = unistd::getpid(); let pgid = unistd::getpid();
if pgid == unistd::tcgetpgrp(nix::libc::STDIN_FILENO)? { if pgid != unistd::getpgrp() {
return Ok(()); unistd::setpgid(pgid, pgid)?;
} }
unistd::setpgid(pgid, pgid)?; if pgid != unistd::tcgetpgrp(nix::libc::STDIN_FILENO)? {
unsafe { signal::signal(Signal::SIGTTOU, SigHandler::SigIgn) }?; unsafe { signal::signal(Signal::SIGTTOU, SigHandler::SigIgn) }?;
unistd::tcsetpgrp(nix::libc::STDIN_FILENO, pgid) unistd::tcsetpgrp(nix::libc::STDIN_FILENO, pgid)?;
}
Ok(())
} }
fn main() { fn main() {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment