diff --git a/src/stl/posix.rs b/src/stl/posix.rs index d428846..481f1c3 100644 --- a/src/stl/posix.rs +++ b/src/stl/posix.rs @@ -471,12 +471,11 @@ pub fn load_posix_shell(syms: &mut SymTable, shell_state: Rc ).expect("couldn't take terminal from owning process") } - if let Err(e) = unistd::setpgid( - unistd::Pid::from_raw(0), - unistd::Pid::from_raw(0) - ) { - panic!("couldn't set PGID: {}", e) - }; + if pid != pgid { + if let Err(e) = unistd::setpgid(pid, pid) { + panic!("couldn't set PGID: {}", e) + }; + } if let Err(e) = unistd::tcsetpgrp(0, pid) { panic!("couldn't grab terminal: {}", e)