提交 12bd0472 编写于 作者: D Derek Parker

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.
上级 77d46a51
......@@ -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 {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册