diff options
author | Bartek IwaĆczuk <biwanczuk@gmail.com> | 2023-03-13 19:31:03 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-03-13 19:31:03 -0400 |
commit | c4771356f27b250e7fdbcede0de5682982720455 (patch) | |
tree | 1d3507a0b9ee7c6388b3dae8c752328c2528fe74 /cli/tools/run.rs | |
parent | a35c8e6588fec21586bcb19146cad19fa01f4f23 (diff) |
refactor: Remove call sites of "deno_core::resolve_url_or_path" (#18169)
These call sites didn't need to use "resolve_url_or_path".
Towards landing https://github.com/denoland/deno/pull/15454
Diffstat (limited to 'cli/tools/run.rs')
-rw-r--r-- | cli/tools/run.rs | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/cli/tools/run.rs b/cli/tools/run.rs index d72378510..d949a1cdb 100644 --- a/cli/tools/run.rs +++ b/cli/tools/run.rs @@ -5,7 +5,9 @@ use std::sync::Arc; use deno_ast::MediaType; use deno_ast::ModuleSpecifier; +use deno_core::anyhow::Context; use deno_core::error::AnyError; +use deno_core::resolve_path; use deno_core::resolve_url_or_path; use deno_graph::npm::NpmPackageReqReference; use deno_runtime::permissions::Permissions; @@ -67,7 +69,8 @@ To grant permissions, set them before the script argument. For example: pub async fn run_from_stdin(flags: Flags) -> Result<i32, AnyError> { let ps = ProcState::build(flags).await?; - let main_module = resolve_url_or_path("./$deno$stdin.ts").unwrap(); + let cwd = std::env::current_dir().context("Unable to get CWD")?; + let main_module = resolve_path("./$deno$stdin.ts", &cwd).unwrap(); let mut worker = create_main_worker( &ps, main_module.clone(), @@ -139,8 +142,9 @@ pub async fn eval_command( ) -> Result<i32, AnyError> { // deno_graph works off of extensions for local files to determine the media // type, and so our "fake" specifier needs to have the proper extension. + let cwd = std::env::current_dir().context("Unable to get CWD")?; let main_module = - resolve_url_or_path(&format!("./$deno$eval.{}", eval_flags.ext))?; + resolve_path(&format!("./$deno$eval.{}", eval_flags.ext), &cwd)?; let ps = ProcState::build(flags).await?; let permissions = PermissionsContainer::new(Permissions::from_options( &ps.options.permissions_options(), |