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

Nicolas George george at nsup.org
Fri Jul 31 10:51:31 CEST 2015

Le tridi 13 thermidor, an CCXXIII, Michael Niedermayer a écrit :
> no disagreement here but as the shell does not do that (well at least
> not bash here)
> it causes moderate inconvenience to the developers
> in everyday work if the terminal needs to be reset after a fate
> failure

And what happens after a FATE failure? Based on my experience, frequently,
developers would copy-paste the failing FATE command line and re-run it
interactively. And since stderr is no longer redirected, the tty gets

No need of a failure, even: just try this:

ffmpeg -lavfi testsrc -f framecrc | head

... ffmpeg is killed by SIGPIPE, which is not caught: terminal trashed.

The stderr test is bogus and only works on a few cases, the tip of the

I strongly urge you to fix your shell configuration instead. I have no idea
why it is not the default configuration, apparently distributors do not care
about trashed ttys. But enabling it is quite trivial. It is not as simple
and as efficient with bash as it is with zsh (ttyctl -f), but still quite
simple: add this in your .bashrc:

bash_tty_state=$(stty -g)
PROMPT_COMMAND='stty $bash_tty_state'

... nothing more (except if you already have a PROMPT_COMMAND).


  Nicolas George
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20150731/c8076411/attachment.sig>

More information about the ffmpeg-devel mailing list