Skip to content

Commit 56b3783

Browse files
committed
Slightly safer to map err
1 parent 3369428 commit 56b3783

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/rescript.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,11 +73,13 @@ impl zed::Extension for ReScriptExtension {
7373
) -> Result<zed::Command> {
7474
let server_path = self.server_script_path(server_id)?;
7575

76+
let current_dir = env::current_dir()
77+
.map_err(|e| format!("failed to get current directory: {e}"))?;
78+
7679
Ok(zed::Command {
7780
command: zed::node_binary_path()?,
7881
args: vec![
79-
env::current_dir()
80-
.unwrap()
82+
current_dir
8183
.join(server_path.as_ref())
8284
.to_string_lossy()
8385
.to_string(),

0 commit comments

Comments
 (0)