Skip to content

fix: wait for child process on Windows restart#84

Merged
eitsupi merged 3 commits intomainfrom
fix/windows-restart
Feb 24, 2026
Merged

fix: wait for child process on Windows restart#84
eitsupi merged 3 commits intomainfrom
fix/windows-restart

Conversation

@eitsupi
Copy link
Copy Markdown
Owner

@eitsupi eitsupi commented Feb 24, 2026

Summary

  • 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.
  • Now the parent waits for the child to exit via child.wait() and propagates its exit code, keeping the terminal session intact throughout the restart.
  • Error paths also now call exit(1) to avoid continuing in a partially-torn-down state.

Test plan

  • On Windows (PowerShell + Windows Terminal), launch arf and run :restart
  • Confirm R session restarts within arf (not dropped back to PowerShell)
  • Confirm no orphaned arf.exe processes in Task Manager after restart

🤖 Generated with Claude Code

eitsupi and others added 2 commits February 24, 2026 12:43
…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]>
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@eitsupi eitsupi merged commit 780f08a into main Feb 24, 2026
14 of 15 checks passed
@eitsupi eitsupi deleted the fix/windows-restart branch February 24, 2026 13:29
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