From daf9e3ea0c76d57decd56eb91e8fc3f90e032fa9 Mon Sep 17 00:00:00 2001 From: wan9chi Date: Mon, 27 Jul 2026 18:29:23 +0800 Subject: [PATCH] fix(output): print notes to stderr A note explains the situation around a command rather than being part of its result, so piping stdout to a file or a parser should not pick it up. Every current caller is prose for a human: `vp check`'s "Format skipped", the dlx yarn@1 fallback, "Version will be downloaded on first use", "Restart your terminal to apply shell changes". This is also what `rfcs/cli-output-polish.md` specified for `note` in both Rust and TypeScript; the implementation used `println!` instead. --- crates/vite_shared/src/output.rs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/crates/vite_shared/src/output.rs b/crates/vite_shared/src/output.rs index c3bda52e4c..add79395bb 100644 --- a/crates/vite_shared/src/output.rs +++ b/crates/vite_shared/src/output.rs @@ -67,14 +67,14 @@ pub fn error(msg: &str) { eprintln!("{} {msg}", "error:".red().bold()); } -/// Print a note message to stdout (supplementary info). -#[expect(clippy::print_stdout, clippy::print_stderr, clippy::disallowed_macros)] +/// Print a note message to stderr (supplementary info). +/// +/// A note explains the situation around a command rather than being part of +/// its result, so it belongs on the diagnostic stream: piping stdout to a file +/// or a parser keeps the command's own output intact. +#[expect(clippy::print_stderr, clippy::disallowed_macros)] pub fn note(msg: &str) { - if user_output_to_stderr() { - eprintln!("{} {msg}", "note:".dimmed().bold()); - } else { - println!("{} {msg}", "note:".dimmed().bold()); - } + eprintln!("{} {msg}", "note:".dimmed().bold()); } /// Print a success line with checkmark to stdout.