aboutsummaryrefslogtreecommitdiff
path: root/lib/std/process
diff options
context:
space:
mode:
authorGiuseppe Cesarano <PecoraInPannaCotta@gmail.com>2025-11-07 08:53:43 +0100
committerGiuseppe Cesarano <PecoraInPannaCotta@gmail.com>2025-11-07 08:53:43 +0100
commitf4159eff9253bb701bacfa14e37bdb80e8dff7da (patch)
treea8123f0f455c66c09d2477deab0204d7bab380c7 /lib/std/process
parent5c0309a9e59413048c97c2fbc7cde5676069c29f (diff)
downloadzig-f4159eff9253bb701bacfa14e37bdb80e8dff7da.tar.gz
zig-f4159eff9253bb701bacfa14e37bdb80e8dff7da.zip
std.Child: start_suspended ported to posix
Diffstat (limited to 'lib/std/process')
-rw-r--r--lib/std/process/Child.zig8
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/std/process/Child.zig b/lib/std/process/Child.zig
index c84c878972..65b49707e4 100644
--- a/lib/std/process/Child.zig
+++ b/lib/std/process/Child.zig
@@ -85,8 +85,8 @@ expand_arg0: Arg0Expand,
/// Darwin-only. Disable ASLR for the child process.
disable_aslr: bool = false,
-/// Darwin and Windows only. Start child process in suspended state. For Darwin it's started
-/// as if SIGSTOP was sent.
+/// Start child process in suspended state.
+/// For Posix systems it's started as if SIGSTOP was sent.
start_suspended: bool = false,
/// Windows-only. Sets the CREATE_NO_WINDOW flag in CreateProcess.
@@ -669,6 +669,10 @@ fn spawnPosix(self: *ChildProcess) SpawnError!void {
posix.setpgid(0, pid) catch |err| forkChildErrReport(err_pipe[1], err);
}
+ if (self.start_suspended) {
+ posix.kill(posix.getpid(), .STOP) catch |err| forkChildErrReport(err_pipe[1], err);
+ }
+
const err = switch (self.expand_arg0) {
.expand => posix.execvpeZ_expandArg0(.expand, argv_buf.ptr[0].?, argv_buf.ptr, envp),
.no_expand => posix.execvpeZ_expandArg0(.no_expand, argv_buf.ptr[0].?, argv_buf.ptr, envp),