authorgravatar for PecoraInPannaCotta@gmail.comGiuseppe Cesarano <PecoraInPannaCotta@gmail.com> 2025-11-07 08:53:43+01:00
committergravatar for PecoraInPannaCotta@gmail.comGiuseppe Cesarano <PecoraInPannaCotta@gmail.com> 2025-11-07 08:53:43+01:00
logf4159eff9253bb701bacfa14e37bdb80e8dff7da
treea8123f0f455c66c09d2477deab0204d7bab380c7
parent5c0309a9e59413048c97c2fbc7cde5676069c29f
signaturelock-open Commit is signed but in an unrecognized format.

std.Child: start_suspended ported to posix


1 files changed, 6 insertions(+), 2 deletions(-)

lib/std/process/Child.zig+6-2
...@@ -85,8 +85,8 @@ expand_arg0: Arg0Expand,...@@ -85,8 +85,8 @@ expand_arg0: Arg0Expand,
85/// Darwin-only. Disable ASLR for the child process.85/// Darwin-only. Disable ASLR for the child process.
86disable_aslr: bool = false,86disable_aslr: bool = false,
8787
88/// Darwin and Windows only. Start child process in suspended state. For Darwin it's started88/// Start child process in suspended state.
89/// as if SIGSTOP was sent.89/// For Posix systems it's started as if SIGSTOP was sent.
90start_suspended: bool = false,90start_suspended: bool = false,
9191
92/// Windows-only. Sets the CREATE_NO_WINDOW flag in CreateProcess.92/// Windows-only. Sets the CREATE_NO_WINDOW flag in CreateProcess.
...@@ -669,6 +669,10 @@ fn spawnPosix(self: *ChildProcess) SpawnError!void {...@@ -669,6 +669,10 @@ fn spawnPosix(self: *ChildProcess) SpawnError!void {
669 posix.setpgid(0, pid) catch |err| forkChildErrReport(err_pipe[1], err);669 posix.setpgid(0, pid) catch |err| forkChildErrReport(err_pipe[1], err);
670 }670 }
671671
672 if (self.start_suspended) {
673 posix.kill(posix.getpid(), .STOP) catch |err| forkChildErrReport(err_pipe[1], err);
674 }
675
672 const err = switch (self.expand_arg0) {676 const err = switch (self.expand_arg0) {
673 .expand => posix.execvpeZ_expandArg0(.expand, argv_buf.ptr[0].?, argv_buf.ptr, envp),677 .expand => posix.execvpeZ_expandArg0(.expand, argv_buf.ptr[0].?, argv_buf.ptr, envp),
674 .no_expand => posix.execvpeZ_expandArg0(.no_expand, argv_buf.ptr[0].?, argv_buf.ptr, envp),678 .no_expand => posix.execvpeZ_expandArg0(.no_expand, argv_buf.ptr[0].?, argv_buf.ptr, envp),