Repository navigation
Preserve each child's exit status when waiting - #197
Merged
Merged
Conversation
demrom
marked this pull request as ready for review
October 22, 2026 17:06
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When two children in one session return different exit codes, waiting for the second and then the first reports the second child's code twice.
waitpidandios_full_waitpidread the shared session status, so a completed child's result can be overwritten before its caller waits.Store the exit code with the synthetic PID and read that slot when waiting. Normal command returns,
ios_exitand commands that finish without starting a thread record their result before the PID is released. Commands that end without recording a result retain status 130, the code already used for cancellation before dispatch. The slot is reset when the existing allocator reuses the PID.tests/child-wait-status.mstarts a child that returns 7 and another that waits for it before callingios_exit(23). The parent waits in reverse order. The same executable reports 23/23 and exits 1 against master, then reports 7/23 and exits 0 with this change. It also checks a missing command returns 127 and empty and NULL commands return 0. Both frameworks were built with Xcode 27.1, arm64 Release, Simulator SDK 27.1 and an iOS 15 deployment target; the patched build uses the command intests/README.md. The root README's all-targets iPhoneOS build also passes after resolving the declared Swift package dependencies and settingIPHONEOS_DEPLOYMENT_TARGET=15.0for Xcode 27.On an iPhone running iOS 27.0.1, the fixture run as an a-Shell command reports 7/23, missing 127 and empty/NULL 0. File copying, pipelines and exit code checks pass, and an ordinary command after the test writes the expected file.