Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: remove use of home crate #27516

Merged
merged 4 commits into from
Jan 2, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 4 additions & 17 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ url = { version = "2.5", features = ["serde", "expose_internals"] }
uuid = { version = "1.3.0", features = ["v4"] }
webpki-root-certs = "0.26.5"
webpki-roots = "0.26"
which = "4.2.5"
which = "6"
yoke = { version = "0.7.4", features = ["derive"] }
zeromq = { version = "=0.4.1", default-features = false, features = ["tcp-transport", "tokio-runtime"] }
zstd = "=0.12.4"
Expand Down
3 changes: 1 addition & 2 deletions ext/node/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ errno = "0.2.8"
faster-hex.workspace = true
h2.workspace = true
hkdf.workspace = true
home = "0.5.9"
http.workspace = true
http-body-util.workspace = true
hyper.workspace = true
Expand Down Expand Up @@ -93,7 +92,7 @@ simd-json = "0.14.0"
sm3 = "0.4.2"
spki.workspace = true
stable_deref_trait = "1.2.0"
sys_traits = { workspace = true, features = ["real"] }
sys_traits = { workspace = true, features = ["real", "winapi", "libc"] }
thiserror.workspace = true
tokio.workspace = true
tokio-eld = "0.2"
Expand Down
7 changes: 6 additions & 1 deletion ext/node/ops/os/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ use std::mem::MaybeUninit;

use deno_core::op2;
use deno_core::OpState;
use sys_traits::EnvHomeDir;

use crate::NodePermissions;

Expand Down Expand Up @@ -282,5 +283,9 @@ where
permissions.check_sys("homedir", "node:os.homedir()")?;
}

Ok(home::home_dir().map(|path| path.to_string_lossy().to_string()))
Ok(
sys_traits::impls::RealSys
.env_home_dir()
.map(|path| path.to_string_lossy().to_string()),
)
}
3 changes: 1 addition & 2 deletions runtime/permissions/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1510,11 +1510,10 @@ impl AllowRunDescriptor {
match which::which_in(text, std::env::var_os("PATH"), cwd) {
Ok(path) => path,
Err(err) => match err {
which::Error::BadAbsolutePath | which::Error::BadRelativePath => {
which::Error::CannotGetCurrentDirAndPathListEmpty => {
return Err(err);
}
which::Error::CannotFindBinaryPath
| which::Error::CannotGetCurrentDir
| which::Error::CannotCanonicalize => {
return Ok(AllowRunDescriptorParseResult::Unresolved(Box::new(err)))
}
Expand Down
Loading