diff options
author | Satya Rohith <me@satyarohith.com> | 2021-04-21 21:22:00 +0530 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-04-21 17:52:00 +0200 |
commit | 3b78f6c4493093701660bba496d87342ffbc08d7 (patch) | |
tree | 8c7a52188f8ead12cab1078f5e5cb4ae62387ba2 /runtime/ops | |
parent | 320c19c7c09f18af7647f2a278dd8c3e18bffba4 (diff) |
fix: do not panic on not found cwd (#10238)
Diffstat (limited to 'runtime/ops')
-rw-r--r-- | runtime/ops/runtime.rs | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/runtime/ops/runtime.rs b/runtime/ops/runtime.rs index d90e92593..a02bf4548 100644 --- a/runtime/ops/runtime.rs +++ b/runtime/ops/runtime.rs @@ -5,6 +5,7 @@ use crate::metrics::RuntimeMetrics; use crate::ops::UnstableChecker; use crate::permissions::Permissions; use deno_core::error::AnyError; +use deno_core::error::Context; use deno_core::serde_json::json; use deno_core::serde_json::Value; use deno_core::ModuleSpecifier; @@ -29,7 +30,9 @@ fn op_main_module( let main = state.borrow::<ModuleSpecifier>().to_string(); let main_url = deno_core::resolve_url_or_path(&main)?; if main_url.scheme() == "file" { - let main_path = std::env::current_dir().unwrap().join(main_url.to_string()); + let main_path = std::env::current_dir() + .context("Failed to get current working directory")? + .join(main_url.to_string()); state .borrow_mut::<Permissions>() .read |