Skip to content

Commit ec5f8fb

Browse files
committed
Add some error context
1 parent d636cb1 commit ec5f8fb

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

crates/utils/src/command.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -139,10 +139,12 @@ impl CommandRunExt for Command {
139139

140140
/// Synchronously execute the child, and return an error if the child exited unsuccessfully.
141141
fn run_capture_stderr(&mut self) -> Result<()> {
142-
let stderr = tempfile::tempfile()?;
142+
let stderr = tempfile::tempfile().context("Allocating tempfile")?;
143143
self.stderr(stderr.try_clone()?);
144144
tracing::trace!("exec: {self:?}");
145-
self.status()?.check_status_with_stderr(stderr)
145+
self.status()
146+
.context("Executing child")?
147+
.check_status_with_stderr(stderr)
146148
}
147149

148150
#[allow(unsafe_code)]
@@ -168,7 +170,7 @@ impl CommandRunExt for Command {
168170
}
169171

170172
fn run_get_output(&mut self) -> Result<Box<dyn std::io::BufRead>> {
171-
let mut stdout = tempfile::tempfile()?;
173+
let mut stdout = tempfile::tempfile().context("Allocating tempfile")?;
172174
self.stdout(stdout.try_clone()?);
173175
self.run_capture_stderr()?;
174176
stdout.seek(std::io::SeekFrom::Start(0)).context("seek")?;

0 commit comments

Comments
 (0)