Skip to content
This repository has been archived by the owner on Jan 18, 2025. It is now read-only.

Commit

Permalink
Print events right after spawning when --why and --clear are used tog…
Browse files Browse the repository at this point in the history
…ether (#198)
  • Loading branch information
passcod committed Jul 9, 2022
1 parent 68221f0 commit 0756ab8
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/config/runtime.rs
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ pub fn runtime(args: &Args, command_order: Vec<&'static str>) -> Result<RuntimeC
config.on_action(move |action: Action| {
let fut = async { Ok::<(), Infallible>(()) };

if print_events {
if print_events && !clear {
for (n, event) in action.events.iter().enumerate() {
eprintln!("[EVENT {}] {}", n, event);
}
Expand Down Expand Up @@ -304,6 +304,16 @@ pub fn runtime(args: &Args, command_order: Vec<&'static str>) -> Result<RuntimeC
.show()?;
}

// with --clear, printing the events right before clearing is useless.
// this way is a bit incorrect as we'll print before every command, but
// it will be actually useful. Perhaps this warrants a new Watchexec hook
// for post-outcome or mid-outcome...
if print_events && clear {
for (n, event) in postspawn.events.iter().enumerate() {
eprintln!("[EVENT {}] {}", n, event);
}
}

#[cfg(target_os = "freebsd")]
return Ok::<(), Infallible>(());
#[cfg(not(target_os = "freebsd"))]
Expand Down

0 comments on commit 0756ab8

Please sign in to comment.