From c9d763502fb1ff9ee76f0745c493e65c1333b1b1 Mon Sep 17 00:00:00 2001 From: Jakub Konka Date: Sat, 10 Dec 2022 22:55:04 +0100 Subject: [PATCH] child_process: add ability to start child suspended on macOS --- lib/std/child_process.zig | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/std/child_process.zig b/lib/std/child_process.zig index 7d7bea323b..b706f0aecb 100644 --- a/lib/std/child_process.zig +++ b/lib/std/child_process.zig @@ -60,6 +60,9 @@ pub const ChildProcess = struct { /// Darwin-only. Disable ASLR for the child process. disable_aslr: bool = false, + /// Darwin-only. Start child process in suspended state as if SIGSTOP was sent. + start_suspended: bool = false, + pub const Arg0Expand = os.Arg0Expand; pub const SpawnError = error{ @@ -578,6 +581,9 @@ pub const ChildProcess = struct { if (self.disable_aslr) { flags |= os.darwin._POSIX_SPAWN_DISABLE_ASLR; } + if (self.start_suspended) { + flags |= os.darwin.POSIX_SPAWN_START_SUSPENDED; + } try attr.set(flags); var actions = try os.posix_spawn.Actions.init();