From 3b78f6c4493093701660bba496d87342ffbc08d7 Mon Sep 17 00:00:00 2001 From: Satya Rohith Date: Wed, 21 Apr 2021 21:22:00 +0530 Subject: fix: do not panic on not found cwd (#10238) --- cli/tools/installer.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'cli/tools') diff --git a/cli/tools/installer.rs b/cli/tools/installer.rs index 747d9cbc0..48e3b8fdd 100644 --- a/cli/tools/installer.rs +++ b/cli/tools/installer.rs @@ -3,6 +3,7 @@ use crate::flags::Flags; use crate::fs_util::canonicalize_path; use deno_core::error::generic_error; use deno_core::error::AnyError; +use deno_core::error::Context; use deno_core::url::Url; use log::Level; use regex::Regex; @@ -175,7 +176,8 @@ pub fn install( let module_path = if module_path.is_absolute() { module_path } else { - let cwd = env::current_dir().unwrap(); + let cwd = env::current_dir() + .context("Failed to get current working directory")?; cwd.join(module_path) }; Url::from_file_path(module_path).expect("Path should be absolute") -- cgit v1.2.3