diff options
author | Nathan Whitaker <17734409+nathanwhit@users.noreply.github.com> | 2024-10-12 12:14:32 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-10-12 12:14:32 -0700 |
commit | 7a990d9d42b633ca70eca235df0f9ba09f876720 (patch) | |
tree | 8c7db663923f478b77cea37a8cae77d59eb27479 /cli/tools/task.rs | |
parent | 8b2c6fc2d22f0a62ceefa71ff739f81796142699 (diff) |
feat(npm): support `--allow-scripts` on `deno run` (and `deno add`, `deno test`, etc) (#26075)
Fixes https://github.com/denoland/deno/issues/25533. Fixes
https://github.com/denoland/deno/issues/25396.
Previously we only supported it on `deno install` and `deno cache`,
which is annoying if you're using `nodeModulesDir: auto`.
Also changes from printing output of lifecycle scripts directly to
capturing the output and only printing it on error.
Diffstat (limited to 'cli/tools/task.rs')
-rw-r--r-- | cli/tools/task.rs | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/cli/tools/task.rs b/cli/tools/task.rs index 464b65d98..502b09d2c 100644 --- a/cli/tools/task.rs +++ b/cli/tools/task.rs @@ -182,17 +182,21 @@ async fn run_task(opts: RunTaskOptions<'_>) -> Result<i32, AnyError> { &task_runner::get_script_with_args(script, cli_options.argv()), ); - task_runner::run_task(task_runner::RunTaskOptions { - task_name, - script, - cwd, - env_vars, - custom_commands, - init_cwd: opts.cli_options.initial_cwd(), - argv: cli_options.argv(), - root_node_modules_dir: npm_resolver.root_node_modules_path(), - }) - .await + Ok( + task_runner::run_task(task_runner::RunTaskOptions { + task_name, + script, + cwd, + env_vars, + custom_commands, + init_cwd: opts.cli_options.initial_cwd(), + argv: cli_options.argv(), + root_node_modules_dir: npm_resolver.root_node_modules_path(), + stdio: None, + }) + .await? + .exit_code, + ) } fn output_task(task_name: &str, script: &str) { |