From: Thomas Lamprecht Date: Fri, 29 Jun 2018 09:57:49 +0000 (+0200) Subject: foolowup: improve/add comments and spacing X-Git-Url: https://git.proxmox.com/?p=pve-common.git;a=commitdiff_plain;h=aea06195b731c464b030af8decfb2f01d9697295 foolowup: improve/add comments and spacing Signed-off-by: Thomas Lamprecht --- diff --git a/src/PVE/RESTEnvironment.pm b/src/PVE/RESTEnvironment.pm index 3155aac..6a53741 100644 --- a/src/PVE/RESTEnvironment.pm +++ b/src/PVE/RESTEnvironment.pm @@ -496,10 +496,11 @@ sub fork_worker { $SIG{CHLD} = $SIG{PIPE} = 'DEFAULT'; $SIG{TTOU} = 'IGNORE'; - # set sess/process group - we want to be able to kill the - # whole process group + # set session/process group allows to kill the process group if ($sync && -t STDIN) { - POSIX::setpgid(0,0) or die "failed to setpgid: $!\n";; + # some sync'ed workers operate on the tty but setsid sessions lose + # the tty, so just create a new pgroup and give it the tty + POSIX::setpgid(0, 0) or die "failed to setpgid: $!\n";; POSIX::tcsetpgrp(fileno(STDIN), $$) or die "failed to tcsetpgrp: $!\n"; } else { POSIX::setsid();