From 720a3da4aceaf02d692540b3d4527d37d6fef597 Mon Sep 17 00:00:00 2001 From: Nixon Enraght-Moony Date: Fri, 24 Sep 2021 17:51:47 +0100 Subject: [PATCH] Give rustfmt spawn error context. --- crates/rust-analyzer/src/handlers.rs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/crates/rust-analyzer/src/handlers.rs b/crates/rust-analyzer/src/handlers.rs index dbbe1841fc9..6b8f1f6d1a9 100644 --- a/crates/rust-analyzer/src/handlers.rs +++ b/crates/rust-analyzer/src/handlers.rs @@ -7,6 +7,7 @@ use std::{ process::{self, Stdio}, }; +use anyhow::Context; use ide::{ AnnotationConfig, AssistKind, AssistResolveStrategy, FileId, FilePosition, FileRange, HoverAction, HoverGotoTypeData, Query, RangeInfo, Runnable, RunnableKind, SingleResolve, @@ -1696,8 +1697,12 @@ fn run_rustfmt( } }; - let mut rustfmt = - rustfmt.stdin(Stdio::piped()).stdout(Stdio::piped()).stderr(Stdio::piped()).spawn()?; + let mut rustfmt = rustfmt + .stdin(Stdio::piped()) + .stdout(Stdio::piped()) + .stderr(Stdio::piped()) + .spawn() + .context(format!("Failed to spawn {:?}", rustfmt))?; rustfmt.stdin.as_mut().unwrap().write_all(file.as_bytes())?;