Skip to content

Commit 786c1a0

Browse files
committed
include io error in commandfailed
1 parent 11ada2c commit 786c1a0

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

tmc-langs-framework/src/lib.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,11 @@ pub enum Error {
3737
PluginNotFound(PathBuf),
3838
#[error("No project directory found in archive during unzip")]
3939
NoProjectDirInZip,
40-
#[error("Running command '{0}' failed")]
41-
CommandFailed(&'static str),
40+
#[error("Running command '{0}' failed: {1}")]
41+
CommandFailed(&'static str, std::io::Error),
4242

4343
#[error("Failed to spawn command: {0}")]
44-
CommandSpawn(std::io::Error),
44+
CommandSpawn(&'static str, std::io::Error),
4545
#[error("Test timed out")]
4646
TestTimeout,
4747

@@ -69,15 +69,15 @@ impl CommandWithTimeout<'_> {
6969
match timeout {
7070
Some(timeout) => {
7171
// spawn process and init timer
72-
let mut child = self.0.spawn().map_err(|e| Error::CommandSpawn(e))?;
72+
let mut child = self.0.spawn().map_err(|e| Error::CommandSpawn(name, e))?;
7373
let timer = Instant::now();
7474
loop {
7575
match child.try_wait()? {
7676
Some(_exit_status) => {
7777
// done, get output
7878
return child
7979
.wait_with_output()
80-
.map_err(|_| Error::CommandFailed(name));
80+
.map_err(|e| Error::CommandFailed(name, e));
8181
}
8282
None => {
8383
// still running, check timeout
@@ -93,7 +93,7 @@ impl CommandWithTimeout<'_> {
9393
}
9494
}
9595
// no timeout, block forever
96-
None => self.0.output().map_err(|_| Error::CommandFailed(name)),
96+
None => self.0.output().map_err(|e| Error::CommandFailed(name, e)),
9797
}
9898
}
9999
}

0 commit comments

Comments
 (0)