diff --git a/proc/exec_darwin.c b/proc/exec_darwin.c index ab35880e..ac2d9b32 100644 --- a/proc/exec_darwin.c +++ b/proc/exec_darwin.c @@ -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. diff --git a/proc/proc_linux.go b/proc/proc_linux.go index 8e17b8d2..10f11d7b 100644 --- a/proc/proc_linux.go +++ b/proc/proc_linux.go @@ -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 {