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/fs_util.rs | |
parent | 320c19c7c09f18af7647f2a278dd8c3e18bffba4 (diff) |
fix: do not panic on not found cwd (#10238)
Diffstat (limited to 'runtime/fs_util.rs')
-rw-r--r-- | runtime/fs_util.rs | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/runtime/fs_util.rs b/runtime/fs_util.rs index bf0735205..93286ecf3 100644 --- a/runtime/fs_util.rs +++ b/runtime/fs_util.rs @@ -1,6 +1,7 @@ // Copyright 2018-2021 the Deno authors. All rights reserved. MIT license. use deno_core::error::AnyError; +use deno_core::error::Context; pub use deno_core::normalize_path; use std::env::current_dir; use std::io::Error; @@ -24,7 +25,8 @@ pub fn resolve_from_cwd(path: &Path) -> Result<PathBuf, AnyError> { let resolved_path = if path.is_absolute() { path.to_owned() } else { - let cwd = current_dir().unwrap(); + let cwd = + current_dir().context("Failed to get current working directory")?; cwd.join(path) }; |