summaryrefslogtreecommitdiff
path: root/cli/tools/installer.rs
diff options
context:
space:
mode:
authorSatya Rohith <me@satyarohith.com>2021-04-21 21:22:00 +0530
committerGitHub <noreply@github.com>2021-04-21 17:52:00 +0200
commit3b78f6c4493093701660bba496d87342ffbc08d7 (patch)
tree8c7a52188f8ead12cab1078f5e5cb4ae62387ba2 /cli/tools/installer.rs
parent320c19c7c09f18af7647f2a278dd8c3e18bffba4 (diff)
fix: do not panic on not found cwd (#10238)
Diffstat (limited to 'cli/tools/installer.rs')
-rw-r--r--cli/tools/installer.rs4
1 files changed, 3 insertions, 1 deletions
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")