Skip to content

Commit f5c5564

Browse files
committed
Fix newline being included after WSL path conversion
1 parent bd30011 commit f5c5564

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

opener/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ maintenance = { status = "passively-maintained" }
1919
version-sync = "0.9"
2020

2121
[target.'cfg(target_os = "linux")'.dependencies]
22+
bstr = "0.2"
2223
wsl = "0.1"
2324

2425
[target.'cfg(windows)'.dependencies]

opener/src/lib.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,7 @@ fn is_wsl() -> bool {
180180

181181
#[cfg(target_os = "linux")]
182182
fn wsl_to_windows_path(path: &OsStr) -> Option<OsString> {
183+
use bstr::ByteSlice;
183184
use std::os::unix::ffi::OsStringExt;
184185

185186
let output = Command::new("wslpath")
@@ -195,7 +196,7 @@ fn wsl_to_windows_path(path: &OsStr) -> Option<OsString> {
195196
return None;
196197
}
197198

198-
Some(OsString::from_vec(output.stdout))
199+
Some(OsString::from_vec(output.stdout.trim_end().to_vec()))
199200
}
200201

201202
#[cfg(not(target_os = "linux"))]

0 commit comments

Comments
 (0)