From 319985add47d94e71e02f8e9128f5918a118989c Mon Sep 17 00:00:00 2001 From: Christopher Vittal Date: Mon, 30 Sep 2019 12:12:17 -0400 Subject: [PATCH] Reset color after writing message in colorize Presently when you `^C` in `zola serve` it is painted with the same color as the previous message. This PR always ensures to reset the color in colorize, before writing the newline. --- src/console.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/console.rs b/src/console.rs index c570715..094d736 100644 --- a/src/console.rs +++ b/src/console.rs @@ -42,8 +42,9 @@ pub fn error(message: &str) { fn colorize(message: &str, color: &ColorSpec) { let mut stdout = StandardStream::stdout(*COLOR_CHOICE); stdout.set_color(color).unwrap(); - writeln!(&mut stdout, "{}", message).unwrap(); + write!(&mut stdout, "{}", message).unwrap(); stdout.set_color(&ColorSpec::new()).unwrap(); + writeln!(&mut stdout).unwrap(); } /// Display in the console the number of pages/sections in the site, and number of images to process