mirror of
https://github.com/denoland/deno.git
synced 2025-08-03 10:33:54 +00:00
fix: do not panic on not found cwd (#10238)
This commit is contained in:
parent
320c19c7c0
commit
3b78f6c449
8 changed files with 43 additions and 6 deletions
|
@ -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 deno_runtime::deno_crypto::rand;
|
||||
use std::env::current_dir;
|
||||
|
@ -81,7 +82,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)
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue