GNOME Bugzilla – Bug 759019
gst-launch-1.0 returns 0 exit code on async error during playback
Last modified: 2015-12-04 15:56:12 UTC
I'm testing a UVC webcam, and i get a flow error (which is fine); what isn't, is that the return code is 0. $ LANG=C gst-launch-1.0 v4l2src num-buffers=1 ! "video/x-raw, width=(int)1920, height=(int)1200, framerate=(fraction)25/1" ! fakesink Setting pipeline to PAUSED ... Pipeline is live and does not need PREROLL ... Setting pipeline to PLAYING ... New clock: GstSystemClock ERROR: from element /GstPipeline:pipeline0/GstV4l2Src:v4l2src0: Internal data flow error. Additional debug info: gstbasesrc.c(2943): gst_base_src_loop (): /GstPipeline:pipeline0/GstV4l2Src:v4l2src0: streaming task paused, reason not-negotiated (-4) Execution ended after 0:00:00.020056914 Setting pipeline to PAUSED ... Setting pipeline to READY ... Setting pipeline to NULL ... Freeing pipeline ... $ echo $? 0
From the code it looks like all code paths that somehow handle ERROR messages would cause non-0 to be returned from main(). I can't reproduce this problem here. Can you follow the code in your case and maybe even provide a patch? :)
Funnily, $ LANG=C gst-launch-1.0 videotestsrc num-buffers=1 ! video/x-raw\,\ format\=\(string\)BGRx\,\ width\=\(int\)3841\,\ height\=\(int\)1321\,\ framerate\=\(fraction\)216/1\,\ pixel-aspect-ratio\=\(fraction\)12/1\,\ interlace-mode\=\(string\)progressive ! ximagesink $ echo $? 1 So it seems restricted to v4l2src indeed.
Take any v4l2 device, ask for unsupported caps, and here you go: $ gst-launch-1.0 v4l2src num-buffers=1 ! "video/x-raw, width=(int)3840, height=(int)2160, framerate=(fraction)60/1" ! fakesink $ echo $? 0 I'll try to reproduce with vivid though.
No need, I can reproduce here too.
Has nothing to do with v4l2src, can be reproduced with: gst-launch-1.0 fakesrc ! identity error-after=5 ! fakesink ; echo $? commit 2ee4cba2485d7f1646d48e4559426aed4ba99c85 Author: Tim-Philipp Müller <tim@centricular.com> Date: Fri Dec 4 15:09:39 2015 +0000 tools: gst-launch: return non-0 exit code on async error When an error happens in playing state, still return a non-0 exit code. https://bugzilla.gnome.org/show_bug.cgi?id=759019
Created attachment 316777 [details] [review] gst-launch: Fix process return value on error In case of a run-time error message, the process return value was left unset. This would lead to error not being caught at shell level.
Hmm, ok. I thought my message was enough, oh well.
Please backport to stable branches.
Comment on attachment 316777 [details] [review] gst-launch: Fix process return value on error In fact the pushed code ignores the "ignore_errors" boolean from the EOS (-e) case. Please consider.
Yes, I agree, push yours please, thanks.
Also on 1.6: commit 057fc558359c63b212d596179cb0a0b658142010 Author: Nicolas Dufresne <nicolas.dufresne@collabora.co.uk> Date: Fri Dec 4 10:22:56 2015 -0500 gst-launch: Fix process return value on error In case of a run-time error message, the process return value was left unset. This would lead to error not being caught at shell level. https://bugzilla.gnome.org/show_bug.cgi?id=759019