Skip to content

Could preSpawnProcessConfigurator be made available for posix_spawn OR fork/exec? #25

Open
@jakepetroules

Description

@jakepetroules

Currently, setting preSpawnProcessConfigurator requires pre-fork on Linux, meaning preSpawnProcessConfigurator can't be used to control the posix_spawn path.

On Linux, the signature is:

public var preSpawnProcessConfigurator: (@convention(c) @Sendable () -> Void)? = nil

Could it instead become:

public enum SpawnStrategy {
    case posixSpawn(_ attr: posix_spawnattr_t?, _ fileactions: posix_spawn_file_actions_t?)
    case forkExec
}

public var preSpawnProcessConfigurator: (@convention(c) @Sendable (inout SpawnStrategy) -> Void)? = nil

...and then the configurator could be called for both the posix_spawn and fork/exec paths, without influencing which one is taken.

Bonus points if this could be applied to Darwin as well (removing the forkExec option), to make the PlatformOptions API interface a little more similar.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions