fix: redirect FFmpeg stdin to /dev/null to prevent TTY corruption#996
Open
berettavexee wants to merge 1 commit into
Open
fix: redirect FFmpeg stdin to /dev/null to prevent TTY corruption#996berettavexee wants to merge 1 commit into
berettavexee wants to merge 1 commit into
Conversation
When FFmpeg is launched without stdin redirection it inherits the terminal. Even with -y (auto-overwrite), FFmpeg may alter TTY settings (echo mode, raw mode) for its interactive prompt handling. If it exits without restoring those settings the terminal is left with echo disabled — the user can type but sees nothing. Add stdin=asyncio.subprocess.DEVNULL to both FFmpeg subprocess calls (converter.py and downloadable.py) so FFmpeg never touches the terminal. Co-Authored-By: Claude Sonnet 4.6 <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.
Problem
After a successful download (with or without conversion), the terminal is left with echo disabled — the user can type but nothing is displayed. Running
resetorstty echorestores it.This is a classic TTY state corruption: a subprocess altered the terminal's echo/raw mode settings and exited without restoring them.
Root cause: both FFmpeg subprocess calls in streamrip are launched without stdin redirection, so FFmpeg inherits the controlling terminal. Even with
-y(auto-overwrite), FFmpeg probes stdin to detect whether it is interactive and may modify TTY flags (disabling echo, enabling raw mode) for its interactive prompt handling. If the process exits abnormally — or in some cases even normally — those flags are not restored.Affected calls:
converter.py— audio format conversionclient/downloadable.py— SoundCloud segment concatenationFix
Pass
stdin=asyncio.subprocess.DEVNULLto bothasyncio.create_subprocess_execcalls. FFmpeg receives/dev/nullas its stdin, never touches the terminal, and cannot corrupt TTY state.Test plan
-c mp3/-c ogg/-c aacconversion → terminal echo works after exit🤖 Generated with Claude Code