Repository navigation
fix: installer crash when piped (curl/irm | python) on Windows and POSIX - #9
Merged
Merged
Conversation
Running `curl -fsSL .../install.py | python` made sys.stdin the pipe (exhausted after reading the script), so termios.tcgetattr(sys.stdin) crashed with "Inappropriate ioctl for device". - read keypresses and the custom path prompt from /dev/tty when stdin is not a TTY, matching how sys.stdin normally behaves - fall back to a plain numbered menu when no terminal exists at all - open /dev/tty with newline="\n" so the universal-newline decoder's pending-CR logic can't swallow the first Enter (needed two presses)
Piping the installer in (irm ... | python) makes stdin the pipe, so input() in ask_custom_path() raised EOFError at the Enter install path prompt. The arrow-key menu kept working because it reads the console via msvcrt instead of stdin; the prompt now does the same via a new read_line(), and EOF is treated as 'no path provided' instead of crashing. Also switch the TUI and messages to ASCII-only (selected marker, navigation hint, ellipsis, em dash) so rendering does not depend on UTF-8 console encoding.
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.
Problem
Both install commands in the README crash when the script is piped in:
curl -fsSL ... | python→termios.error: (25, 'Not a tty')while rendering the menuirm ... | py→EOFError: EOF when reading a lineat theEnter install path:promptRoot cause: piping the script makes stdin the pipe. Python parses the program
from stdin, so by the time the installer runs, stdin is neither a TTY nor readable.
The menu survived on Windows only because
get_key()reads the console viamsvcrt; the path prompt usedinput(), which reads stdin → EOF → traceback.Changes
get_input_stream()— when stdin isn't a TTY (POSIX), read keypresses andprompts from
/dev/ttyinstead; falls back to a plain numbered menu when noterminal exists at all.
read_line()— on Windows, read the custom path from the console withmsvcrt(same mechanism the menu already uses) instead ofinput(). HandlesEnter, Backspace, Ctrl+C, and ignores arrow/function-key byte prefixes.
ask_custom_path()— EOF is treated as "no path provided" → the existingclean cancel, instead of a traceback.
❯→>,↑/↓→Up/Down,…→...,—→-) sooutput doesn't depend on UTF-8 console encoding, and survives PowerShell 5.1's
ASCII
$OutputEncodingwhen piping.