Skip to content

Commit

Permalink
v1.0.3 优化报错提示
Browse files Browse the repository at this point in the history
  • Loading branch information
LuckyPuppy514 committed Nov 30, 2024
1 parent 8a5685d commit 2d5b152
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 12 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "url-scheme-handler"
version = "1.0.2"
version = "1.0.3"
edition = "2021"

[dependencies]
Expand Down
29 changes: 18 additions & 11 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down

0 comments on commit 2d5b152

Please sign in to comment.