Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions src/melt/melt.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,11 @@
#include "io.h"

static mlt_producer melt = NULL;
static volatile sig_atomic_t stop_signum = 0;

static void stop_handler(int signum)
{
stop_signum = signum;
if (melt) {
mlt_properties properties = MLT_PRODUCER_PROPERTIES(melt);
mlt_properties_set_int(properties, "done", 1);
Expand Down Expand Up @@ -1138,5 +1140,17 @@ int main(int argc, char **argv)
// Flush all open writable streams
fflush(NULL);

// Interrupted by a signal: the render is incomplete. Restore the default
// handler and re-raise so the exit status reflects the signal (e.g. 130 for
// SIGINT), mirroring abnormal_exit_handler above. (#547)
if (stop_signum && !error) {
#ifndef _WIN32
term_exit();
signal(stop_signum, SIG_DFL);
raise(stop_signum);
#endif
error = EXIT_FAILURE; // Windows: no re-raise, so surface a non-zero status
Comment thread
ddennedy marked this conversation as resolved.
}
Comment thread
ddennedy marked this conversation as resolved.

return error;
}
Loading