Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
jakepetroules opened this issue Apr 24, 2025 · 0 comments
Labels
bug Something isn't working

Comments

@jakepetroules
Copy link
Contributor

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.

@jakepetroules jakepetroules added the bug Something isn't working label Apr 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant