Commit 476fc674 authored by Zeeshan Ali's avatar Zeeshan Ali

gst-inspect: Errors in red color

parent e2a8be69
Pipeline #8861 failed with stages
in 8 minutes and 6 seconds
...@@ -7,6 +7,7 @@ extern crate glib_sys as glib_ffi; ...@@ -7,6 +7,7 @@ extern crate glib_sys as glib_ffi;
extern crate colored; extern crate colored;
extern crate nix; extern crate nix;
use colored::Colorize;
mod piped_stdio; mod piped_stdio;
...@@ -15,7 +16,7 @@ fn main() { ...@@ -15,7 +16,7 @@ fn main() {
match piped_stdio::PipedStdio::new() { match piped_stdio::PipedStdio::new() {
Ok(p) => Some(p), Ok(p) => Some(p),
Err(e) => { Err(e) => {
eprintln!("Error redirecting output to pager: {}", e); print_error(e, "Error redirecting output to pager");
None None
} }
} }
...@@ -25,7 +26,7 @@ fn main() { ...@@ -25,7 +26,7 @@ fn main() {
if let Err(e) = gst::init() { if let Err(e) = gst::init() {
// FIXME: Color output // FIXME: Color output
eprintln!("Error initializing GStreamer: {}", e); print_error(e, "Error initializing GStreamer");
std::process::exit(-1); std::process::exit(-1);
} }
...@@ -33,6 +34,13 @@ fn main() { ...@@ -33,6 +34,13 @@ fn main() {
print_element_list(false); print_element_list(false);
} }
fn print_error<E: std::error::Error>(error: E, description: &str) {
eprintln!(
"{}",
format!("{}: {}", description, error.to_string()).red()
);
}
fn print_element_list(print_all: bool) { fn print_element_list(print_all: bool) {
let registry = gst::Registry::get(); let registry = gst::Registry::get();
let plugins = registry.get_plugin_list(); let plugins = registry.get_plugin_list();
......
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