fix: wait for child process on Windows restart#84
Merged
Conversation
…ediately On Windows, :restart spawned a new arf process then immediately called exit(0), causing the parent to die and PowerShell to reclaim the terminal. The child process became orphaned and couldn't properly interact with the terminal. Now the parent waits for the child to exit and propagates its exit code, keeping the terminal session intact throughout the restart. Co-Authored-By: Claude Opus 4.6 <[email protected]>
Add exit(1) after error messages in the spawn failure and wait failure paths so the process does not continue in a partially-torn-down state. Co-Authored-By: Claude Opus 4.6 <[email protected]>
There was a problem hiding this comment.
Pull request overview
This PR fixes a Windows-specific issue where the :restart command would cause the parent process to exit immediately after spawning a child, resulting in PowerShell reclaiming the terminal and orphaning the child process. The fix implements proper process lifecycle management on Windows by having the parent wait for the child to complete before exiting with the child's status code.
Changes:
- Parent process now waits for child process to exit before terminating on Windows
- Exit code is propagated from child to parent to maintain proper status
- Error paths now call
exit(1)to ensure the process terminates with failure status
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-Authored-By: Claude Opus 4.6 <[email protected]>
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.
Summary
:restartspawned a new arf process then immediately calledexit(0), causing the parent to die and PowerShell to reclaim the terminal. The child process became orphaned.child.wait()and propagates its exit code, keeping the terminal session intact throughout the restart.exit(1)to avoid continuing in a partially-torn-down state.Test plan
:restart🤖 Generated with Claude Code