refactor(core): pass cwd explicitly to resolve_path (#18092)

Towards landing #15454
This commit is contained in:
Bartek Iwańczuk 2023-03-13 13:50:23 -04:00 committed by GitHub
parent 4c2aeb2502
commit e8f22c0765
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 33 additions and 13 deletions

View file

@ -1,5 +1,6 @@
// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
use deno_core::anyhow::Context;
use deno_core::error::AnyError;
use deno_core::FsModuleLoader;
use deno_runtime::deno_broadcast_channel::InMemoryBroadcastChannel;
@ -69,7 +70,10 @@ async fn main() -> Result<(), AnyError> {
let js_path =
Path::new(env!("CARGO_MANIFEST_DIR")).join("examples/hello_runtime.js");
let main_module = deno_core::resolve_path(&js_path.to_string_lossy())?;
let main_module = deno_core::resolve_path(
&js_path.to_string_lossy(),
&std::env::current_dir().context("Unable to get CWD")?,
)?;
let permissions = PermissionsContainer::allow_all();
let mut worker = MainWorker::bootstrap_from_options(