Use setsid() instead of setpgid()
This makes it possible to run commands that allocates TTYs and still capture their output and reap the process on completion. > setpgid — set process group ID for job control > setsid — create session and set process group ID With this in place, the `waitpid` call detects that the process has exited even if the process allocated a TTY, and is able to unblock the runner and continue. Further, the output of the command is also shown in the controlling terminal.
This commit is contained in:
parent
e0f649d79a
commit
9fd25dd667
|
@ -114,7 +114,7 @@ mod imp {
|
|||
}
|
||||
|
||||
command
|
||||
.before_exec(|| setpgid(Pid::from_raw(0), Pid::from_raw(0)).map_err(from_nix_error))
|
||||
.before_exec(|| setsid().map_err(from_nix_error).map(|_|()))
|
||||
.spawn()
|
||||
.and_then(|p| {
|
||||
Ok(Process {
|
||||
|
|
Loading…
Reference in New Issue