authorgravatar for kubkon@jakubkonka.comJakub Konka <kubkon@jakubkonka.com> 2022-12-10 22:55:04+01:00
committergravatar for kubkon@jakubkonka.comJakub Konka <kubkon@jakubkonka.com> 2022-12-10 22:55:04+01:00
logc9d763502fb1ff9ee76f0745c493e65c1333b1b1
treedaba178316e995df2577f8e55d4a6fb75474fa14
parentf7fea080b25f932b352d38f126e0a179c5163f68

child_process: add ability to start child suspended on macOS


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

lib/std/child_process.zig+6
...@@ -60,6 +60,9 @@ pub const ChildProcess = struct {...@@ -60,6 +60,9 @@ pub const ChildProcess = struct {
60 /// Darwin-only. Disable ASLR for the child process.60 /// Darwin-only. Disable ASLR for the child process.
61 disable_aslr: bool = false,61 disable_aslr: bool = false,
6262
63 /// Darwin-only. Start child process in suspended state as if SIGSTOP was sent.
64 start_suspended: bool = false,
65
63 pub const Arg0Expand = os.Arg0Expand;66 pub const Arg0Expand = os.Arg0Expand;
6467
65 pub const SpawnError = error{68 pub const SpawnError = error{
...@@ -578,6 +581,9 @@ pub const ChildProcess = struct {...@@ -578,6 +581,9 @@ pub const ChildProcess = struct {
578 if (self.disable_aslr) {581 if (self.disable_aslr) {
579 flags |= os.darwin._POSIX_SPAWN_DISABLE_ASLR;582 flags |= os.darwin._POSIX_SPAWN_DISABLE_ASLR;
580 }583 }
584 if (self.start_suspended) {
585 flags |= os.darwin.POSIX_SPAWN_START_SUSPENDED;
586 }
581 try attr.set(flags);587 try attr.set(flags);
582588
583 var actions = try os.posix_spawn.Actions.init();589 var actions = try os.posix_spawn.Actions.init();