From 9533b9434c668caad2d672f127dc9e0e9223f5a5 Mon Sep 17 00:00:00 2001 From: Michael Lohr Date: Sat, 14 Sep 2024 15:01:39 +0200 Subject: [PATCH 1/2] fix: Improve error messages --- src/lib.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index c03e34c..41a432a 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -74,14 +74,18 @@ pub fn convert( let cmd = Command::new("wsl.exe") .args(args) .arg(path.replace('\\', "\\\\")) - .output()?; + .output() + .map_err(|e| format!("Error executing wsl.exe: {}", e))?; let code = cmd.status.code().unwrap_or(-1); if code != 0 { return Err(format!("Error getting wslpath: {}", code).into()); } - Ok(std::str::from_utf8(&cmd.stdout)?.trim().to_string()) + Ok(std::str::from_utf8(&cmd.stdout) + .map_err(|e| format!("Error converting output to string: {}", e))? + .trim() + .to_string()) } #[cfg(test)] From c5ae51ecc32ff424e204298bcc4a97662cabde91 Mon Sep 17 00:00:00 2001 From: Michael Lohr Date: Sat, 14 Sep 2024 15:03:17 +0200 Subject: [PATCH 2/2] chore: Bump version to 0.1.2 --- Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index 1cb2e23..9d9019f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wslpath2" -version = "0.1.1" +version = "0.1.2" edition = "2021" authors = ["Pratik Chowdhury ", "Michael Lohr "] description = "Convert Windows to WSL paths and vice-versa"