Skip to content

os: support child processes on Linux and Darwin - #5634

Closed
yohimik wants to merge 5 commits into
tinygo-org:devfrom
yohimik:upstream-pr/os-exec-posix-spawn
Closed

yohimik wants to merge 5 commits into
tinygo-org:devfrom
yohimik:upstream-pr/os-exec-posix-spawn

Conversation

@yohimik

@yohimik yohimik commented Aug 30, 2026

Copy link
Copy Markdown

Superseded by #5699. The problem is tracked in #5695.

Closed on 17 September 2026 with a request for an issue first. The replacement uses the same patch, rebased on 18 September onto dev at 93940cb6. Its description contains the scope, dependencies, and test status.

@yohimik

yohimik commented Sep 2, 2026

Copy link
Copy Markdown
Author

Rebased on dev after the 0.42.0 release. The change applies on top of v0.42.0
as released without a conflict, and the diff is unchanged.

Use posix_spawn on hosted Linux and Darwin. Map process files, apply the
working directory and process group, and clear the child signal mask.
Use wait4 for process status and support Kill and Signal.

Mark Darwin pipes close-on-exec under ForkLock. Darwin also needs the
fcntl wrapper in PR tinygo-org#5612 and the libSystem symbols in PR tinygo-org#5636.
Concurrent spawn and pipe creation need the RWMutex fix in PR tinygo-org#5630.

Keep the process stubs on other targets and add process regression tests.
Open /dev/null in the child before closing a nil or unnamed descriptor. Save remap sources before these actions. This avoids a parent descriptor check and its race with concurrent open.

Use descriptor reads and exec redirection in remap tests. Check nil slots and temporary descriptors. The tests pass with ordinary Go on Darwin and Linux. Both TinyGo os suites pass with released compiler source overlays. Darwin also needs the addopen symbol from PR tinygo-org#5636.
@deadprogram

Copy link
Copy Markdown
Member

Same feedback as the other recent PRs @yohimik

Please open an issue first with the specific problem you had. Follow AGENTS.md guidelines.

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants