summaryrefslogtreecommitdiff
path: root/cli/tools/run.rs
diff options
context:
space:
mode:
authorBartek IwaƄczuk <biwanczuk@gmail.com>2023-03-13 22:44:16 -0400
committerGitHub <noreply@github.com>2023-03-14 02:44:16 +0000
commit9aa20b3ba758765863a4c1055097fda399efcfc3 (patch)
tree08ee8de378feb8037bbf609912939718620eaf08 /cli/tools/run.rs
parent48ede89f1f192df28cc74822d7bb79b0b4bd0957 (diff)
refactor: --watch commands use deno_core::resolve_url_or_path (#18172)
This commit changes various CLI subcommands that have support for the "--watch" flag to use initial current working directory when resolving "main module". This is part of migration towards explicitly passing current working directory to "deno_core::resolve_url_or_path" API. As a side effect this makes "deno <subcommand> --watch" more aligned to user expectations, where calling "Deno.chdir()" during program doesn't break watcher. Towards landing https://github.com/denoland/deno/pull/15454
Diffstat (limited to 'cli/tools/run.rs')
-rw-r--r--cli/tools/run.rs3
1 files changed, 1 insertions, 2 deletions
diff --git a/cli/tools/run.rs b/cli/tools/run.rs
index 04ddcb4d9..84ec75e1a 100644
--- a/cli/tools/run.rs
+++ b/cli/tools/run.rs
@@ -9,7 +9,6 @@ use deno_core::anyhow::Context;
use deno_core::error::AnyError;
use deno_core::resolve_path;
use deno_core::resolve_url_or_path;
-use deno_core::resolve_url_or_path_deprecated;
use deno_graph::npm::NpmPackageReqReference;
use deno_runtime::permissions::Permissions;
use deno_runtime::permissions::PermissionsContainer;
@@ -104,10 +103,10 @@ pub async fn run_from_stdin(flags: Flags) -> Result<i32, AnyError> {
// code properly.
async fn run_with_watch(flags: Flags, script: String) -> Result<i32, AnyError> {
let flags = Arc::new(flags);
- let main_module = resolve_url_or_path_deprecated(&script)?;
let (sender, receiver) = tokio::sync::mpsc::unbounded_channel();
let mut ps =
ProcState::build_for_file_watcher((*flags).clone(), sender.clone()).await?;
+ let main_module = resolve_url_or_path(&script, ps.options.initial_cwd())?;
let operation = |main_module: ModuleSpecifier| {
ps.reset_for_file_watcher();