Skip to content

Commit d756b21

Browse files
committed
update to released crate
1 parent f5351a7 commit d756b21

File tree

3 files changed

+31
-34
lines changed

3 files changed

+31
-34
lines changed

Cargo.lock

Lines changed: 7 additions & 16 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,7 @@ thiserror = "2.0.9"
2626
tokio = { version = "1", features = ["fs", "io-std", "io-util", "macros", "process", "rt-multi-thread", "sync", "time"], optional = true }
2727
deno_path_util = "0.4.0"
2828
sys_traits = { version = "0.1.14", optional = true, features = ["real", "winapi", "libc"] }
29-
# temporarily using until https://github.com/harryfei/which-rs/pull/109 is released
30-
which = { package = "temp_deno_which", version = "0.1.0", default-features = false }
29+
which = { version = "8.0.0", default-features = false }
3130

3231
[target.'cfg(unix)'.dependencies]
3332
nix = { version = "0.29.0", features = ["signal"], optional = true }

src/shell/which.rs

Lines changed: 23 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -84,28 +84,35 @@ impl which::sys::Sys for ShellState {
8484
std::env::split_paths(paths).collect()
8585
}
8686

87-
fn env_var_os(&self, name: &OsStr) -> Option<OsString> {
88-
self.get_var(name).cloned()
87+
fn env_path(&self) -> Option<OsString> {
88+
self.get_var(OsStr::new("PATH")).cloned()
89+
}
90+
91+
fn env_path_ext(&self) -> Option<OsString> {
92+
self.get_var(OsStr::new("PATHEXT")).cloned()
8993
}
9094

9195
fn env_windows_path_ext(&self) -> Cow<'static, [String]> {
9296
Cow::Owned(
9397
self
94-
.env_var(OsStr::new("PATHEXT"))
95-
.map(|pathext| {
96-
pathext
97-
.split(';')
98-
.filter_map(|s| {
99-
if s.as_bytes().first() == Some(&b'.') {
100-
Some(s.to_owned())
101-
} else {
102-
// Invalid segment; just ignore it.
103-
None
104-
}
105-
})
106-
.collect::<Vec<_>>()
98+
.env_path_ext()
99+
.and_then(|pathext| {
100+
Some(
101+
pathext
102+
.to_str()?
103+
.split(';')
104+
.filter_map(|s| {
105+
if s.as_bytes().first() == Some(&b'.') {
106+
Some(s.to_owned())
107+
} else {
108+
// Invalid segment; just ignore it.
109+
None
110+
}
111+
})
112+
.collect::<Vec<_>>(),
113+
)
107114
})
108-
.unwrap_or_else(|_| {
115+
.unwrap_or_else(|| {
109116
vec![
110117
".EXE".to_string(),
111118
".CMD".to_string(),

0 commit comments

Comments
 (0)