child_process: add ability to start child suspended on macOS

This commit is contained in:
Jakub Konka 2022-12-10 22:55:04 +01:00
parent f7fea080b2
commit c9d763502f

View File

@ -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();