From 2d1780b1cf37ae4a7f3597d7c44ee53c9dc7cfd1 Mon Sep 17 00:00:00 2001 From: GyDi Date: Tue, 15 Mar 2022 12:51:39 +0800 Subject: [PATCH] fix: adjsut open cmd error --- src-tauri/src/cmds.rs | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src-tauri/src/cmds.rs b/src-tauri/src/cmds.rs index 1ea6355..1f3e746 100644 --- a/src-tauri/src/cmds.rs +++ b/src-tauri/src/cmds.rs @@ -348,24 +348,26 @@ fn open_path_cmd(path: PathBuf, err_str: &str) -> Result<(), String> { match result { Ok(child) => match child.wait_with_output() { Ok(out) => { + // 退出码不为0 不一定没有调用成功 + // 因此仅做warn log且不返回错误 if let Some(code) = out.status.code() { if code != 0 { - log::error!( - "failed to open path {:?} for {} (code {code})", - &path, + log::warn!("failed to open {:?} (code {})", &path, code); + log::warn!( + "open cmd stdout: {}, stderr: {}", + String::from_utf8_lossy(&out.stdout), String::from_utf8_lossy(&out.stderr), ); - return Err(err_str.into()); } } } Err(err) => { - log::error!("failed to open path {:?} for {err}", &path); + log::error!("failed to open {:?} for {err}", &path); return Err(err_str.into()); } }, Err(err) => { - log::error!("failed to open path {:?} for {err}", &path); + log::error!("failed to open {:?} for {err}", &path); return Err(err_str.into()); } }