[FFmpeg-devel] [PATCH] ffmpeg.c: use sigterm_handler with sigpipe

Moritz Barsnick barsnick at gmx.net
Fri Jan 12 00:45:32 EET 2018

On Thu, Jan 11, 2018 at 22:43:48 +0100, Nicolas George wrote:
> SIGTERM is there for a reason. It prevents programs whose output was
> closed from continuing needlessly. Ignoring it unconditionally will lose
> that property, which is desirable in most cases.

This patch doesn't change the handling of SIGTERM, and it doesn't add
ignoring of any signal. It avoids "ignoring" of SIGPIPE, where ffmpeg
used to interrupt unconditionally. With this patch, ffmpeg will clean
up on SIGPIPE, allowing e.g. other outputs to be finalized correctly.

> Furthermore, the signal handler you are proposing is designed for
> interactive signals and will probably not give the results you want in
> this case.

Is SIGPIPE an interactive signal? Anything on the other side of output
file(name) "-" or "pipe:N" may terminate for some reason.

> Just use your shell to set it to SIG_IGN when necessary.

This patch does NOT try to ignore anything. ffmpeg won't keep running
due to ignoring of SIGPIPE, it will terminate more cleanly due to
handling it. The former is not desired. (But yes, shall handing to
enforce ignoring it would allow that.)

Best regards,

More information about the ffmpeg-devel mailing list