diff --git a/Cargo.toml b/Cargo.toml index 864cf16..5f2c7dc 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "url-scheme-handler" -version = "1.0.2" +version = "1.0.3" edition = "2021" [dependencies] diff --git a/src/main.rs b/src/main.rs index 4b2eb94..0b8faa4 100644 --- a/src/main.rs +++ b/src/main.rs @@ -145,17 +145,24 @@ fn main() -> std::io::Result<()> { { app_path = app.path.as_deref().unwrap_or(""); println!("Executing command: {} {}", app_path, args); - let output = Command::new(app_path) - .raw_arg(args) - .output() - .expect("Failed to execute command"); - - if output.status.success() { - let stdout = String::from_utf8_lossy(&output.stdout); - println!("Output: {}", stdout); - } else { - let stderr = String::from_utf8_lossy(&output.stderr); - show_message_box("Error", &stderr); + let output = Command::new(app_path).raw_arg(args).output(); + + match output { + Ok(output) => { + if !output.status.success() { + let stderr = String::from_utf8_lossy(&output.stderr); + show_message_box("Error", &stderr); + } else { + println!("Command executed successfully"); + } + } + Err(e) => { + show_message_box( + "Error", + &format!("{}\n{}", app_path, &e.to_string()), + ); + open_setting_widow(); + } } } else { show_message_box(