Draft
Fix /copy command crash on Windows due to /dev/tty handling#1
Conversation
Co-authored-by: admannon <1027194+admannon@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix issue 15193 in gemini-cli
Fix /copy command crash on Windows due to /dev/tty handling
Dec 23, 2025
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
The
/copycommand crashes on Windows attempting to open/dev/tty, a Unix-specific device file that doesn't exist on Windows. Similar permission errors occur on macOS.Details
Root cause:
fs.createWriteStream('/dev/tty')returns a stream object synchronously but emits errors asynchronously, bypassing the try-catch block.Changes:
/dev/ttyentirely on Windowsfs.accessSync()to verify writability before creating stream on Unix platforms/dev/tty→ stderr → stdout → clipboardyRelated Issues
Fixes google-gemini#15193
How to Validate
Windows:
macOS/Linux:
Pre-Merge Checklist
Warning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
https://api.github.com/repos/google-gemini/gemini-cli/issues/15193/usr/bin/curl curl -s REDACTED(http block)marketplace.visualstudio.com/usr/local/bin/node /usr/local/bin/node --conditions node --conditions development /home/REDACTED/work/gemini-cli/gemini-cli/node_modules/tinypool/dist/entry/process.js --conditions /usr/bin/grep /home/REDACTED/worsort uniq /usr/bin/cat grep core�� d" | sort | uniq | wc -l cat ode in/sh /bin/sh /usr/bin/sort ode(dns block)play.googleapis.com/usr/local/bin/node /usr/local/bin/node --conditions node --conditions development /home/REDACTED/work/gemini-cli/gemini-cli/node_modules/tinypool/dist/entry/process.js node /bin/sh run(dns block)test-server/usr/local/bin/node /usr/local/bin/node --conditions node --conditions development /home/REDACTED/work/gemini-cli/gemini-cli/node_modules/tinypool/dist/entry/process.js sort /bin/sh p/bin/sh eck /usr/local/bin/nDROP /bin/sh -c d" | sort | uniq | wc -l /usr/local/bin/node /usr/bin/wc node --conditions /bin/sh wc(dns block)test-server.com/usr/local/bin/node /usr/local/bin/node --conditions node --conditions development /home/REDACTED/work/gemini-cli/gemini-cli/node_modules/tinypool/dist/entry/process.js sort /bin/sh p/bin/sh eck /usr/local/bin/nDROP /bin/sh -c d" | sort | uniq | wc -l /usr/local/bin/node /usr/bin/wc node --conditions /bin/sh wc(dns block)wombat-dressing-room.appspot.com/usr/local/bin/node node /usr/local/bin/npm install(dns block)/usr/local/bin/node node /usr/local/bin/npm ci sh -c ges/cli/src/ui/utils/commandUtils.test.ts(dns block)If you need me to access, download, or install something from one of these locations, you can either:
Original prompt
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.