Fix stdin inheritance for --execute on non-Unix platforms#191
Merged
Conversation
On non-Unix platforms (Windows), the --execute flag was passing None for stdin_content to execute_streaming(), which caused stdin to be set to Stdio::null(). This prevented interactive programs like vim, python -i, or claude from reading user input. The fix adds an inherit_stdin parameter to execute_streaming(): - When true and stdin_content is None, uses Stdio::inherit() - When false and stdin_content is None, uses Stdio::null() Call sites updated: - InteractiveOutput::execute() (non-Unix): passes true for interactive use - execute_command_in_worktree(): passes false for non-interactive hooks Added test that pipes input to `wt switch --execute "cat"` and verifies the cat command receives and outputs that input, proving stdin inheritance. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.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.
Summary
--executecommands on non-Unix platforms (Windows) couldn't read from stdinvim,python -i, orclaudewould fail immediately with EOFexecute_streaming()usedStdio::null()instead ofStdio::inherit()when no stdin content was providedChanges
inherit_stdinparameter toexecute_streaming()functionInteractiveOutput::execute()now passestruefor interactive useexecute_command_in_worktree()passesfalsefor non-interactive hooksTest plan
🤖 Generated with Claude Code