Skip to content
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
22 changes: 10 additions & 12 deletions Cargo.lock

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

5 changes: 2 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ deno_native_certs = "0.3.0"
deno_npm = "=0.35.0"
deno_path_util = "=0.4.0"
deno_semver = "=0.8.1"
deno_task_shell = "=0.24.0"
deno_task_shell = "=0.25.1"
deno_terminal = "=0.2.2"
deno_unsync = { version = "0.4.4", default-features = false }
deno_whoami = "0.1.0"
Expand Down Expand Up @@ -251,8 +251,6 @@ smallvec = "1.8"
socket2 = { version = "0.5.3", features = ["all"] }
sys_traits = "=0.1.16"
tar = "=0.4.43"
# temporarily using until https://github.com/harryfei/which-rs/pull/109 is released
temp_deno_which = { version = "0.1.0", default-features = false }
tempfile = "3.4.0"
termcolor = "1.1.3"
thiserror = "2.0.12"
Expand All @@ -279,6 +277,7 @@ weak-table = "0.3.2"
web-transport-proto = "0.2.3"
webpki-root-certs = "0.26.5"
webpki-roots = "0.26"
which = { version = "8.0.0", default-features = false }
yoke = { version = "0.7.4", features = ["derive"] }
zeromq = { version = "=0.4.1", default-features = false, features = ["tcp-transport", "tokio-runtime"] }
zip = { version = "2.4.1", default-features = false, features = ["flate2"] }
Expand Down
27 changes: 26 additions & 1 deletion cli/task_runner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,13 +93,18 @@ pub struct TaskResult {
}

pub async fn run_task(
opts: RunTaskOptions<'_>,
mut opts: RunTaskOptions<'_>,
) -> Result<TaskResult, AnyError> {
let script = get_script_with_args(opts.script, opts.argv);
let seq_list = deno_task_shell::parser::parse(&script)
.with_context(|| format!("Error parsing script '{}'.", opts.task_name))?;
let env_vars =
prepare_env_vars(opts.env_vars, opts.init_cwd, opts.root_node_modules_dir);
if !opts.custom_commands.contains_key("deno") {
opts
.custom_commands
.insert("deno".to_string(), Rc::new(DenoCommand::default()));
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

deno_task_shell no longer handles this resolving deno to the current exe, so we handle that here.

let state = deno_task_shell::ShellState::new(
env_vars,
opts.cwd,
Expand Down Expand Up @@ -265,6 +270,26 @@ impl ShellCommand for NpmCommand {
}
}

pub struct DenoCommand(ExecutableCommand);

impl Default for DenoCommand {
fn default() -> Self {
Self(ExecutableCommand::new(
"deno".to_string(),
std::env::current_exe().unwrap(),
))
}
}

impl ShellCommand for DenoCommand {
fn execute(
&self,
context: ShellCommandContext,
) -> LocalBoxFuture<'static, ExecuteResult> {
self.0.execute(context)
}
}

pub struct NodeCommand;

impl ShellCommand for NodeCommand {
Expand Down
2 changes: 1 addition & 1 deletion runtime/permissions/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ percent-encoding = { workspace = true, features = [] }
serde.workspace = true
serde_json.workspace = true
sys_traits.workspace = true
temp_deno_which.workspace = true
thiserror.workspace = true
url.workspace = true
which.workspace = true

[target.'cfg(windows)'.dependencies]
winapi = { workspace = true, features = ["commapi", "knownfolders", "mswsock", "objbase", "psapi", "shlobj", "tlhelp32", "winbase", "winerror", "winuser", "winsock2", "processenv", "wincon", "wincontypes"] }
Expand Down
18 changes: 11 additions & 7 deletions runtime/permissions/which.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ use std::ffi::OsStr;
use std::ffi::OsString;
use std::path::PathBuf;

pub use temp_deno_which::Error;
use temp_deno_which::sys::Sys;
pub use which::Error;
use which::sys::Sys;

pub fn which_in(
sys: impl WhichSys,
Expand All @@ -14,7 +14,7 @@ pub fn which_in(
cwd: PathBuf,
) -> Result<PathBuf, Error> {
let sys = WhichSysAdapter(sys);
let config = temp_deno_which::WhichConfig::new_with_sys(sys)
let config = which::WhichConfig::new_with_sys(sys)
.custom_cwd(cwd)
.binary_name(OsString::from(binary_name));
let config = match path {
Expand Down Expand Up @@ -69,8 +69,12 @@ impl<TSys: WhichSys> Sys for WhichSysAdapter<TSys> {
}
}

fn env_var_os(&self, name: &OsStr) -> Option<std::ffi::OsString> {
self.0.env_var_os(name)
fn env_path(&self) -> Option<OsString> {
self.0.env_var_os("PATH")
}

fn env_path_ext(&self) -> Option<OsString> {
self.0.env_var_os("PATHEXT")
}

fn metadata(
Expand Down Expand Up @@ -157,7 +161,7 @@ pub struct WhichReadDirEntrySysAdapter<TFsDirEntry: sys_traits::FsDirEntry>(
TFsDirEntry,
);

impl<TFsDirEntry: sys_traits::FsDirEntry> temp_deno_which::sys::SysReadDirEntry
impl<TFsDirEntry: sys_traits::FsDirEntry> which::sys::SysReadDirEntry
for WhichReadDirEntrySysAdapter<TFsDirEntry>
{
fn file_name(&self) -> std::ffi::OsString {
Expand All @@ -173,7 +177,7 @@ pub struct WhichMetadataSysAdapter<TMetadata: sys_traits::FsMetadataValue>(
TMetadata,
);

impl<TMetadata: sys_traits::FsMetadataValue> temp_deno_which::sys::SysMetadata
impl<TMetadata: sys_traits::FsMetadataValue> which::sys::SysMetadata
for WhichMetadataSysAdapter<TMetadata>
{
fn is_symlink(&self) -> bool {
Expand Down
Loading