Commit ea285e37 authored by Julian Rother's avatar Julian Rother

Fixed job cancel checks

parent 3fe1ca62
...@@ -49,7 +49,7 @@ int main(int argc, char *argv[]) ...@@ -49,7 +49,7 @@ int main(int argc, char *argv[])
while (1) while (1)
{ {
canceled = ping_job(jobid, "running", "{\"log\": \"%s\"}", jescape(get_avlogbuf())); canceled = ping_job(jobid, "running", "{\"log\": \"%s\"}", jescape(get_avlogbuf()));
if (canceled) if (canceled == 1)
kill(pid, SIGINT); /* Stop ffmpeg */ kill(pid, SIGINT); /* Stop ffmpeg */
poll(&fds, 1, 15000); poll(&fds, 1, 15000);
if (fds.revents & POLLIN) if (fds.revents & POLLIN)
...@@ -59,7 +59,7 @@ int main(int argc, char *argv[]) ...@@ -59,7 +59,7 @@ int main(int argc, char *argv[])
} }
waitpid(pid, &ret, 0); 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())); ping_job(jobid, "finished", "{\"log\": \"%s\"}", jescape(get_avlogbuf()));
else if (WIFSIGNALED(ret)) else if (WIFSIGNALED(ret))
job_failed("Subprocesses was killed by signal %s (%i)", strsignal(WTERMSIG(ret)), WTERMSIG(ret)); job_failed("Subprocesses was killed by signal %s (%i)", strsignal(WTERMSIG(ret)), WTERMSIG(ret));
......
...@@ -337,7 +337,7 @@ int main(int argc, char *argv[]) ...@@ -337,7 +337,7 @@ int main(int argc, char *argv[])
{ {
canceled = ping_job(jobid, "running", "{\"progress\": %i, \"log\": \"%s\"}", _progress, canceled = ping_job(jobid, "running", "{\"progress\": %i, \"log\": \"%s\"}", _progress,
jescape(get_avlogbuf())); jescape(get_avlogbuf()));
if (canceled) if (canceled == 1)
job_failed("Job canceled"); job_failed("Job canceled");
progress = _progress; progress = _progress;
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment