diff options
author | John Hawkinson <jhawk@mit.edu> | 2016-10-21 20:44:49 -0400 |
---|---|---|
committer | John Hawkinson <jhawk@mit.edu> | 2016-10-22 00:34:08 -0400 |
commit | 00ca7552317bb69ce8eb84582d658d5e52997394 (patch) | |
tree | 1548f4a94f9c3dda958efd673829c6666e662b73 | |
parent | 69c2d42bd730b4ea07fe5ba9015049423b71c8a9 (diff) |
[get_exe_version] Do version probes with <&-
When doing version probes for ffmpeg, do the
equivalent of calling it as:
ffmpeg -version <&-
Where <&- is shell syntax for closing stdin before calling the
program. This is roughly equivalent to </dev/null without actually
opening /dev/null.
This prevents ffmpeg -version from hanging when run in the background.
Fixes #955.
The reason is that ffmpeg tries to manipulate stdin to set up terminal
characteristic, and that causes the kernel to suspend the parent
process (youtube-dl).
Note that closing stdin is achieved by calling subprocess.Popen() with
stdin set to subprocess.PIPE and without passing any input to
Popen.communicate(). This is somewhat subtle.
-rw-r--r-- | youtube_dl/utils.py | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/youtube_dl/utils.py b/youtube_dl/utils.py index 28941673f..a89ff6908 100644 --- a/youtube_dl/utils.py +++ b/youtube_dl/utils.py @@ -1820,6 +1820,7 @@ def get_exe_version(exe, args=['--version'], try: out, _ = subprocess.Popen( [encodeArgument(exe)] + args, + stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.STDOUT).communicate() except OSError: return False |