From 014be6ece335d2147b8a32434204acfb15339fab Mon Sep 17 00:00:00 2001 From: Ava Hahn Date: Mon, 17 Apr 2023 20:17:42 -0700 Subject: [PATCH] fix needless pg churn --- src/stl/posix.rs | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) 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)