[get_exe_version] Do version probes with <&-
authorJohn Hawkinson <jhawk@mit.edu>
Sat, 22 Oct 2016 00:44:49 +0000 (20:44 -0400)
committerJohn Hawkinson <jhawk@mit.edu>
Sat, 22 Oct 2016 04:34:08 +0000 (00:34 -0400)
commit00ca7552317bb69ce8eb84582d658d5e52997394
tree1548f4a94f9c3dda958efd673829c6666e662b73
parent69c2d42bd730b4ea07fe5ba9015049423b71c8a9
[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.
youtube_dl/utils.py