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,
8585/// Darwin-only. Disable ASLR for the child process.
8686disable_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.
9090start_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),