[FFmpeg-devel] [PATCHv2] ffmpeg: modify tty state when stderr is redirected
Ganesh Ajjanagadde
gajjanag at mit.edu
Fri Jul 31 14:40:15 CEST 2015
On Fri, Jul 31, 2015 at 7:48 AM, Nicolas George <george at nsup.org> wrote:
> Le tridi 13 thermidor, an CCXXIII, Ganesh Ajjanagadde a écrit :
>> Nevertheless, echo $? invoked right after this yields 2 for both.
>> The reason this happens is the md5sum wrapper sees that the output
>> file has not been written,
>> and errors out there (see the .err files for precisely what I mean).
>> This is why I did not notice it.
>
> Ok.
>
>> Seeing the above, I think just the change in ffmpeg.c along with
>> telling people of the workarounds for both bashrc and zshrc
>> should be enough, with no modification to run-tests.sh.
>
> Indeed, but the change to add -nostdin to FATE is also right: FATE is not an
> interactive process, it should not listen for interactive commands. If the
> cat paws the q key while FATE is running, it will cause a failure, it should
> not.
>
> There are three issues, and one right fix for each of them:
>
> 1. ffmpeg reads command on stdin and needs stdin to be a tty in cbreak mode:
> the test must be on stdin, not any other file descriptor. Actually, no
> test at all should work too, since tcgetattr() would fail anyway.
>
> -> The patch that has just been reverted was right.
Indeed, tcgetattr is enough, no need for isatty. I removed the isatty stuff,
removes an ugly ifdef and simplifies the code. Made this patch 1.
>
> 2. ffmpeg can crash, ffmpeg can not catch all signals (example: memory-leak,
> OOM killer, SIGKILL, uncatchable): the shell should be configured to
> restore the tty in a sane state.
>
> -> "ttyctl -f" in ~/.zshrc, "bash_tty_mode=$(stty -g);
> PROMPT_COMMAND='stty $bash_tty_mode'" in ~/.bashrc; that can be added in
> the FAQ or the wiki.
Added to FAQ, I think faq gets read more by end users.
Note that this is useful for them as well, not just developers who
want to run fate, etc.
Made this patch 2.
>
> 3. FATE is non-interactive: it should not listen to interactive commands.
>
> -> run FATE with -nostdin.
Made this patch 3.
Thanks for disentangling the separate issues very neatly
with a mathematical precision.
>
> Regards,
>
> --
> Nicolas George
>
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
More information about the ffmpeg-devel
mailing list