Skip to content

Commit 688c03b

Browse files
committed
fix logging of actions
1 parent f73c106 commit 688c03b

File tree

1 file changed

+14
-10
lines changed

1 file changed

+14
-10
lines changed

src/cmd/mod.rs

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -536,23 +536,27 @@ fn log_command(
536536
return future::err(Error::from(CommandError::Timeout(timeout.as_secs())));
537537
}
538538

539+
actions.next_input(&line);
540+
if let Some(f) = &mut process_lines {
541+
f(&line, &mut actions);
542+
}
543+
let lines = actions.take_lines();
544+
539545
if log_output {
540-
info!("[{}] {}", kind.prefix(), line);
546+
for line in &lines {
547+
info!("[{}] {}", kind.prefix(), line);
548+
}
541549
}
542-
future::ok((kind, line))
550+
551+
future::ok((kind, lines))
543552
})
544553
.fold(
545554
(Vec::new(), Vec::new()),
546-
move |mut res, (kind, line)| -> Result<_, Error> {
547-
actions.next_input(&line);
548-
549-
if let Some(f) = &mut process_lines {
550-
f(&line, &mut actions);
551-
}
555+
move |mut res, (kind, mut lines)| -> Result<_, Error> {
552556
if capture {
553557
match kind {
554-
OutputKind::Stdout => res.0.append(&mut actions.take_lines()),
555-
OutputKind::Stderr => res.1.append(&mut actions.take_lines()),
558+
OutputKind::Stdout => res.0.append(&mut lines),
559+
OutputKind::Stderr => res.1.append(&mut lines),
556560
}
557561
}
558562
Ok(res)

0 commit comments

Comments
 (0)