Commit c9d763502f

Jakub Konka <kubkon@jakubkonka.com>
2022-12-10 22:55:04
child_process: add ability to start child suspended on macOS
1 parent f7fea08
Changed files (1)
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();