From fe906a1b6f0f417ec45e77d3ff92a34a53008ab6 Mon Sep 17 00:00:00 2001 From: Casey Rodarmor Date: Thu, 12 Dec 2019 17:55:55 -0800 Subject: [PATCH] Fix regression in error message color printing (#566) Make the word "error" print in red instead of plain text. --- src/error_result_ext.rs | 2 +- tests/integration.rs | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/error_result_ext.rs b/src/error_result_ext.rs index d52880b..0ab5c87 100644 --- a/src/error_result_ext.rs +++ b/src/error_result_ext.rs @@ -10,7 +10,7 @@ impl ErrorResultExt for Result { Ok(ok) => Ok(ok), Err(error) => { if color.stderr().active() { - eprintln!("{} {:#}", color.error().paint("error:"), error); + eprintln!("{}: {:#}", color.stderr().error().paint("error"), error); } else { eprintln!("error: {}", error); } diff --git a/tests/integration.rs b/tests/integration.rs index d3942ca..7176e14 100644 --- a/tests/integration.rs +++ b/tests/integration.rs @@ -970,7 +970,7 @@ test! { justfile: "b := a\na := `exit 100`\nbar:\n echo '{{`exit 200`}}'", args: ("--color", "always"), stdout: "", - stderr: "\u{1b}[1;31merror:\u{1b}[0m \u{1b}[1mBacktick failed with exit code 100 + stderr: "\u{1b}[1;31merror\u{1b}[0m: \u{1b}[1mBacktick failed with exit code 100 \u{1b}[0m |\n2 | a := `exit 100`\n | \u{1b}[1;31m^^^^^^^^^^\u{1b}[0m\n", status: 100, } @@ -1008,7 +1008,7 @@ recipe: @exit 100", args: ("--color=always"), stdout: "", - stderr: "\u{1b}[1;31merror:\u{1b}[0m \u{1b}[1m\ + stderr: "\u{1b}[1;31merror\u{1b}[0m: \u{1b}[1m\ Recipe `recipe` failed on line 3 with exit code 100\u{1b}[0m\n", status: 100, }