Skip to content

Fix: Resolve stdin/stdout I/O errors on macOS/Linux after tool update and relaunch#490

Merged
ajpinedam merged 2 commits into
mainfrom
fix/unix.relaunch.inputs
Dec 3, 2025
Merged

Fix: Resolve stdin/stdout I/O errors on macOS/Linux after tool update and relaunch#490
ajpinedam merged 2 commits into
mainfrom
fix/unix.relaunch.inputs

Conversation

@ajpinedam
Copy link
Copy Markdown
Contributor

GitHub Issue: closes #

PR Type:

  • 🐞 Bugfix

What is the current behavior? 🤔

When users selected the "Update" option on macOS/Linux, the tool would update and relaunch, but the relaunched process lost its connection to the terminal's stdin. This caused interactive CLI prompts to fail with errors like:

"zsh: command not found: n"
"Error Input/Output error"
Users were unable to respond to prompts such as "Attempt to fix? [y/n]" after the relaunch.

What is the new behavior? 🚀

Implemented atomic process replacement on Unix systems using the execv() system call via P/Invoke. A temporary shell script performs the update and relaunch sequence, with execv() replacing the current process to preserve the terminal session and file descriptors (stdin/stdout/stderr). This ensures interactive CLI prompts function correctly after the tool updates itself.

PR Checklist ✅

Please check if your PR fulfills the following requirements:

Other information ℹ️

Copy link
Copy Markdown
Contributor

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 addresses stdin/stdout I/O errors that occurred when the uno-check tool updated and relaunched itself on macOS/Linux systems. The solution replaces the previous background process approach with an atomic process replacement using the Unix execv() system call via P/Invoke, which preserves the terminal session and file descriptors.

Key changes:

  • Implements P/Invoke signature for Unix execv() system call
  • Generates a temporary shell script that handles the update sequence and relaunches the tool
  • Uses execv() to atomically replace the current process, maintaining terminal connectivity

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread UnoCheck/ToolUpdater.cs
Comment thread UnoCheck/ToolUpdater.cs
Comment thread UnoCheck/ToolUpdater.cs
Comment thread UnoCheck/ToolUpdater.cs
Comment thread UnoCheck/ToolUpdater.cs Outdated
Comment thread UnoCheck/ToolUpdater.cs
Comment thread UnoCheck/ToolUpdater.cs
Comment thread UnoCheck/ToolUpdater.cs
Comment thread UnoCheck/ToolUpdater.cs
Comment thread UnoCheck/ToolUpdater.cs
Copy link
Copy Markdown
Contributor

Copilot AI commented Dec 2, 2025

@ajpinedam I've opened a new pull request, #491, to work on those changes. Once the pull request is ready, I'll request review from you.

@ajpinedam ajpinedam enabled auto-merge (rebase) December 3, 2025 17:03
@ajpinedam ajpinedam merged commit 37560fb into main Dec 3, 2025
52 checks passed
@ajpinedam ajpinedam deleted the fix/unix.relaunch.inputs branch December 3, 2025 17:04
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.

5 participants