From ea285e371e8a27508e1fad89009fb9c3c92542ec Mon Sep 17 00:00:00 2001 From: Julian Rother <julianr@fsmpi.rwth-aachen.de> Date: Sat, 13 Jan 2018 19:44:57 +0100 Subject: [PATCH] Fixed job cancel checks --- simple_live_transcode.c | 4 ++-- transcode.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/simple_live_transcode.c b/simple_live_transcode.c index d982980..e8dfbdf 100644 --- a/simple_live_transcode.c +++ b/simple_live_transcode.c @@ -49,7 +49,7 @@ int main(int argc, char *argv[]) while (1) { canceled = ping_job(jobid, "running", "{\"log\": \"%s\"}", jescape(get_avlogbuf())); - if (canceled) + if (canceled == 1) kill(pid, SIGINT); /* Stop ffmpeg */ poll(&fds, 1, 15000); if (fds.revents & POLLIN) @@ -59,7 +59,7 @@ int main(int argc, char *argv[]) } waitpid(pid, &ret, 0); - if (canceled && (WEXITSTATUS(ret) == 255 || (WIFSIGNALED(ret) && WTERMSIG(ret) == SIGINT))) + if (canceled == 1 && (WEXITSTATUS(ret) == 255 || (WIFSIGNALED(ret) && WTERMSIG(ret) == SIGINT))) ping_job(jobid, "finished", "{\"log\": \"%s\"}", jescape(get_avlogbuf())); else if (WIFSIGNALED(ret)) job_failed("Subprocesses was killed by signal %s (%i)", strsignal(WTERMSIG(ret)), WTERMSIG(ret)); diff --git a/transcode.c b/transcode.c index 357ab1c..84bec33 100644 --- a/transcode.c +++ b/transcode.c @@ -337,7 +337,7 @@ int main(int argc, char *argv[]) { canceled = ping_job(jobid, "running", "{\"progress\": %i, \"log\": \"%s\"}", _progress, jescape(get_avlogbuf())); - if (canceled) + if (canceled == 1) job_failed("Job canceled"); progress = _progress; } -- GitLab