fix(cli): restore terminal state after Ctrl+C in interactive commands#1407
Merged
Brooooooklyn merged 3 commits intomainfrom Apr 17, 2026
Merged
fix(cli): restore terminal state after Ctrl+C in interactive commands#1407Brooooooklyn merged 3 commits intomainfrom
Brooooooklyn merged 3 commits intomainfrom
Conversation
Agent-Logs-Url: https://github.com/voidzero-dev/vite-plus/sessions/a9e99ef9-0713-4570-8c7a-d2cd4752e1c3 Co-authored-by: Brooooooklyn <3468483+Brooooooklyn@users.noreply.github.com>
Claude created this pull request from a session on behalf of
Brooooooklyn
April 17, 2026 08:05
View session
✅ Deploy Preview for viteplus-preview canceled.
|
Member
- Make cmd mutable in execution.rs to allow spawning child process - Move #[cfg(unix)] import to top of file for proper formatting 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com> Co-authored-by: Brooooooklyn <3468483+Brooooooklyn@users.noreply.github.com>
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 interrupting
vp devorvp previewwith Ctrl+C on Unix terminals (particularly macOS/Ghostty), escape sequences appeared in the shell prompt. This occurred because Vite sets the terminal to raw mode for interactive features, and when SIGINT interrupted the child process, the terminal state wasn't restored before the parent exited.Changes
crates/vite_command/src/lib.rs:TerminalStateGuardRAII guard that saves terminal attributes viatcgetattr()on creation and restores viatcsetattr()on dropexecute_with_terminal_guard()wrapper function that applies the guard during command executionpackages/cli/binding/src/cli/execution.rs:resolve_and_execute()to detect interactive commands (Dev,Preview)crates/vite_command/Cargo.toml:"term"feature tonixdependency for terminal state APIsImplementation
The fix follows the same RAII pattern used in
vite_shared/src/header.rsfor raw mode management and only impacts interactive dev servers where terminal corruption can occur.