Only make new process a group leader, not session
We're not dealing with a debugged process having its own controlling terminal at this point, so no need to make the new process a session leader. Simply making the process a group leader will suffice for our purposes at the moment.
This commit is contained in:
parent
77d46a51fb
commit
12bd0472d2
@ -37,13 +37,9 @@ fork_exec(char *argv0, char **argv, int size,
|
||||
read(fd[0], &sig, 1);
|
||||
close(fd[0]);
|
||||
|
||||
// Create a new session for this process.
|
||||
if (setsid() < 0) {
|
||||
// Could not set session, but still want to create
|
||||
// a new process group.
|
||||
if (setpgid(0, 0) < 0) {
|
||||
return -1;
|
||||
}
|
||||
// Create a new process group.
|
||||
if (setpgid(0, 0) < 0) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
// Set errno to zero before a call to ptrace.
|
||||
|
@ -44,7 +44,7 @@ func Launch(cmd []string) (*Process, error) {
|
||||
proc.Args = cmd
|
||||
proc.Stdout = os.Stdout
|
||||
proc.Stderr = os.Stderr
|
||||
proc.SysProcAttr = &syscall.SysProcAttr{Ptrace: true, Setsid: true}
|
||||
proc.SysProcAttr = &syscall.SysProcAttr{Ptrace: true, Setpgid: true}
|
||||
err = proc.Start()
|
||||
})
|
||||
if err != nil {
|
||||
|
Loading…
Reference in New Issue
Block a user