Skip to content

Commit f4159ef

Browse files
std.Child: start_suspended ported to posix
1 parent 5c0309a commit f4159ef

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

lib/std/process/Child.zig

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,8 @@ expand_arg0: Arg0Expand,
8585
/// Darwin-only. Disable ASLR for the child process.
8686
disable_aslr: bool = false,
8787

88-
/// Darwin and Windows only. Start child process in suspended state. For Darwin it's started
89-
/// as if SIGSTOP was sent.
88+
/// Start child process in suspended state.
89+
/// For Posix systems it's started as if SIGSTOP was sent.
9090
start_suspended: bool = false,
9191

9292
/// Windows-only. Sets the CREATE_NO_WINDOW flag in CreateProcess.
@@ -669,6 +669,10 @@ fn spawnPosix(self: *ChildProcess) SpawnError!void {
669669
posix.setpgid(0, pid) catch |err| forkChildErrReport(err_pipe[1], err);
670670
}
671671

672+
if (self.start_suspended) {
673+
posix.kill(posix.getpid(), .STOP) catch |err| forkChildErrReport(err_pipe[1], err);
674+
}
675+
672676
const err = switch (self.expand_arg0) {
673677
.expand => posix.execvpeZ_expandArg0(.expand, argv_buf.ptr[0].?, argv_buf.ptr, envp),
674678
.no_expand => posix.execvpeZ_expandArg0(.no_expand, argv_buf.ptr[0].?, argv_buf.ptr, envp),

0 commit comments

Comments
 (0)