Skip to content

Commit b6aeab4

Browse files
committed
report full cmds in error to give more context
fix #71
1 parent c8a4248 commit b6aeab4

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

src/process.rs

+11-7
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ impl Cmds {
218218
.map_err(|e| new_cmd_io_error(&e, &full_cmds, &file, line))?;
219219
}
220220
let child = cmd
221-
.spawn(current_dir, with_output)
221+
.spawn(full_cmds.clone(), current_dir, with_output)
222222
.map_err(|e| new_cmd_io_error(&e, &full_cmds, &file, line))?;
223223
children.push(child);
224224
}
@@ -392,20 +392,24 @@ impl Cmd {
392392
(self.args.len() > args.len(), self)
393393
}
394394

395-
fn spawn(mut self, current_dir: &mut PathBuf, with_output: bool) -> Result<CmdChild> {
395+
fn spawn(
396+
mut self,
397+
full_cmds: String,
398+
current_dir: &mut PathBuf,
399+
with_output: bool,
400+
) -> Result<CmdChild> {
396401
let arg0 = self.arg0();
397402
if arg0 == CD_CMD {
398403
self.run_cd_cmd(current_dir, &self.file, self.line)?;
399404
Ok(CmdChild::new(
400405
CmdChildHandle::SyncFn,
401-
self.cmd_str(),
406+
full_cmds,
402407
self.file,
403408
self.line,
404409
self.stdout_logging,
405410
self.stderr_logging,
406411
))
407412
} else if self.in_cmd_map {
408-
let cmd_str = self.cmd_str();
409413
let pipe_out = self.stdout_logging.is_none();
410414
let mut env = CmdEnv {
411415
args: self
@@ -442,7 +446,7 @@ impl Cmd {
442446
let handle = thread::Builder::new().spawn(move || internal_cmd(&mut env))?;
443447
Ok(CmdChild::new(
444448
CmdChildHandle::Thread(handle),
445-
cmd_str,
449+
full_cmds,
446450
self.file,
447451
self.line,
448452
self.stdout_logging,
@@ -452,7 +456,7 @@ impl Cmd {
452456
internal_cmd(&mut env)?;
453457
Ok(CmdChild::new(
454458
CmdChildHandle::SyncFn,
455-
cmd_str,
459+
full_cmds,
456460
self.file,
457461
self.line,
458462
self.stdout_logging,
@@ -486,7 +490,7 @@ impl Cmd {
486490
let child = cmd.spawn()?;
487491
Ok(CmdChild::new(
488492
CmdChildHandle::Proc(child),
489-
self.cmd_str(),
493+
full_cmds,
490494
self.file,
491495
self.line,
492496
self.stdout_logging,

0 commit comments

Comments
 (0)