Skip to content

Commit

Permalink
Fix newline being included after WSL path conversion
Browse files Browse the repository at this point in the history
  • Loading branch information
Seeker14491 committed Jun 12, 2021
1 parent bd30011 commit f5c5564
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions opener/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ maintenance = { status = "passively-maintained" }
version-sync = "0.9"

[target.'cfg(target_os = "linux")'.dependencies]
bstr = "0.2"
wsl = "0.1"

[target.'cfg(windows)'.dependencies]
Expand Down
3 changes: 2 additions & 1 deletion opener/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,7 @@ fn is_wsl() -> bool {

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

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

Some(OsString::from_vec(output.stdout))
Some(OsString::from_vec(output.stdout.trim_end().to_vec()))
}

#[cfg(not(target_os = "linux"))]
Expand Down

0 comments on commit f5c5564

Please sign in to comment.