Prevent ffmpeg child processes from attempting to read from the controlling TTY in non-piped mode (which can disrupt terminal echo/canonical modes) by applying the known -nostdin workaround in addition to using DEVNULL for subprocess stdin.
Preserve existing behavior when callers explicitly request stdin piping so pipe_stdin=True remains unchanged.
Description
In ffmpeg/_run.py, when pipe_stdin is False the compiled ffmpeg argument list is modified to insert '-nostdin' after the executable, and stdin remains subprocess.DEVNULL for the subprocess.
When pipe_stdin is True no -nostdin is injected and stdin stays as subprocess.PIPE.
Updated ffmpeg/tests/test_ffmpeg.py to expect the injected '-nostdin' only for the non-piped pipe_stdin=False cases and to expect stdin=subprocess.DEVNULL in that branch.
Testing
Ran a focused unittest.mock check that called ffmpeg.run_async with pipe_stdin=False and pipe_stdin=True and asserted that '-nostdin' is injected only in the non-piped case and that stdin is DEVNULL for non-piped and PIPE for piped, and that check passed.
Attempted to run the pytest selection with a temporary ffmpeg shim via pytest ffmpeg/tests/test_ffmpeg.py -k "run_async", but collection failed due to the environment missing the pytest-mock (mocker) fixture, so the pytest run could not execute.
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
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.
Motivation
Description
Testing
Codex Task