From d18cbe5943440171ad15a15d98b0a1e22a4686c3 Mon Sep 17 00:00:00 2001 From: Zeeshan Ali Date: Fri, 10 Nov 2017 16:53:32 +0100 Subject: [PATCH] examples: More robust cli arg handling --- examples/src/bin/decodebin.rs | 3 ++- examples/src/bin/playbin.rs | 3 ++- examples/src/bin/player.rs | 3 ++- examples/src/bin/toc.rs | 3 ++- 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/examples/src/bin/decodebin.rs b/examples/src/bin/decodebin.rs index 40b419f87..42f2e6e2e 100644 --- a/examples/src/bin/decodebin.rs +++ b/examples/src/bin/decodebin.rs @@ -12,7 +12,8 @@ fn main() { let uri: &str = if args.len() == 2 { args[1].as_ref() } else { - panic!("Usage: decodebin file_path") + println!("Usage: decodebin file_path"); + std::process::exit(-1); }; let pipeline = gst::Pipeline::new(None); diff --git a/examples/src/bin/playbin.rs b/examples/src/bin/playbin.rs index 2fdbf554b..01b8b0881 100644 --- a/examples/src/bin/playbin.rs +++ b/examples/src/bin/playbin.rs @@ -12,7 +12,8 @@ fn main() { let uri: &str = if args.len() == 2 { args[1].as_ref() } else { - panic!("Usage: playbin uri") + println!("Usage: playbin uri"); + std::process::exit(-1); }; let playbin = gst::ElementFactory::make("playbin", None).unwrap(); diff --git a/examples/src/bin/player.rs b/examples/src/bin/player.rs index 857d8a460..a0daf4417 100644 --- a/examples/src/bin/player.rs +++ b/examples/src/bin/player.rs @@ -70,7 +70,8 @@ fn main() { let uri: &str = if args.len() == 2 { args[1].as_ref() } else { - panic!("Usage: player uri") + println!("Usage: player uri"); + std::process::exit(-1); }; #[cfg(not(feature = "gst-player"))] { diff --git a/examples/src/bin/toc.rs b/examples/src/bin/toc.rs index 16fdff6c0..71b30a25e 100644 --- a/examples/src/bin/toc.rs +++ b/examples/src/bin/toc.rs @@ -12,7 +12,8 @@ fn main() { let uri: &str = if args.len() == 2 { args[1].as_ref() } else { - panic!("Usage: toc file_path") + println!("Usage: toc file_path"); + std::process::exit(-1); }; let pipeline = gst::Pipeline::new(None);