[FFmpeg-devel] [PATCH] ffmpeg: modify tty state when stderr is redirected

Ganesh Ajjanagadde gajjanag at mit.edu
Sat Aug 1 14:42:27 CEST 2015


On Sat, Aug 1, 2015 at 6:54 AM, Nicolas George <george at nsup.org> wrote:
> Le quartidi 14 thermidor, an CCXXIII, Michael Niedermayer a écrit :
>> > ffmpeg -lavfi testsrc -f framecrc | head
>> Thats interresting, i tried this and it did not trash my terminal
>> also ive almost never seen ffmpeg trash my terminal with the current
>> code. No matter how i run it
>
> As Ganesh noticed, I forgot the output "-" in my example, but you probably
> noticed that on your own, and that is not the issue.

Interesting. Doing a ttyctl -u (in zsh) and testing without the patch
does give this as an issue.

>
> I just ran some tests and it appears that bash restores the tty state if the
> command was killed by a signal but not if it exited normally.
>
> Therefore, "ffmpeg ... - | head" will have the tty restored because ffmpeg
> dies by SIGPIPE, but "strace ffmpeg ... - | head" will trash the tty state
> because bash does not know of the SIGPIPE. The same goes for anything that
> runs ffmpeg as a sub-process, from "sh -c ..." to the FATE harness.
>
> Well, bash does part of its job, but I consider it should do more: leaving
> the tty trashed just because you inserted strace in front of the command is
> bad policy.
>
> 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