Skip to content

Commit

Permalink
fix: attempt to highlight stderr output and stdout/stderr error output
Browse files Browse the repository at this point in the history
  • Loading branch information
Brian May committed Oct 17, 2024
1 parent 545e637 commit 26aa21f
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions src/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,11 @@ impl Display for CommandSuccess {
f.write_str("\n")?;

f.write_str("stderr:\n")?;
f.write_str(&self.stderr)?;
for line in self.stderr.lines() {
f.write_str("--> ")?;
f.write_str(line)?;
f.write_str("\n")?;
}
f.write_str("\n")?;

Ok(())
Expand Down Expand Up @@ -118,11 +122,19 @@ impl Display for CommandError {
f.write_str("\n")?;

f.write_str("stdout:\n")?;
f.write_str(&self.stdout)?;
for line in self.stdout.lines() {
f.write_str("--> ")?;
f.write_str(line)?;
f.write_str("\n")?;
}
f.write_str("\n")?;

f.write_str("stderr:\n")?;
f.write_str(&self.stderr)?;
for line in self.stderr.lines() {
f.write_str("--> ")?;
f.write_str(line)?;
f.write_str("\n")?;
}
f.write_str("\n")?;

Ok(())
Expand Down

0 comments on commit 26aa21f

Please sign in to comment.