Skip to content

Commit 720a3da

Browse files
committed
Give rustfmt spawn error context.
1 parent eb17e90 commit 720a3da

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

crates/rust-analyzer/src/handlers.rs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ use std::{
77
process::{self, Stdio},
88
};
99

10+
use anyhow::Context;
1011
use ide::{
1112
AnnotationConfig, AssistKind, AssistResolveStrategy, FileId, FilePosition, FileRange,
1213
HoverAction, HoverGotoTypeData, Query, RangeInfo, Runnable, RunnableKind, SingleResolve,
@@ -1696,8 +1697,12 @@ fn run_rustfmt(
16961697
}
16971698
};
16981699

1699-
let mut rustfmt =
1700-
rustfmt.stdin(Stdio::piped()).stdout(Stdio::piped()).stderr(Stdio::piped()).spawn()?;
1700+
let mut rustfmt = rustfmt
1701+
.stdin(Stdio::piped())
1702+
.stdout(Stdio::piped())
1703+
.stderr(Stdio::piped())
1704+
.spawn()
1705+
.context(format!("Failed to spawn {:?}", rustfmt))?;
17011706

17021707
rustfmt.stdin.as_mut().unwrap().write_all(file.as_bytes())?;
17031708

0 commit comments

Comments
 (0)