fix: write logs to stderr to avoid interfering with piped output
Change log() function to use console.error instead of console.log. This ensures that when stdout is piped (e.g., to 'code -'), only the prompt file path is sent through the pipe, while progress messages remain visible on the terminal via stderr. Usage: echo 'content' | yarn --silent docs:create --products X | code -jts-multifile-plugins-guide
parent
45a5de02b6
commit
e4a659b269
|
|
@ -55,10 +55,11 @@ const colors = {
|
|||
};
|
||||
|
||||
/**
|
||||
* Print colored output
|
||||
* Print colored output to stderr (so it doesn't interfere with piped output)
|
||||
*/
|
||||
function log(message, color = 'reset') {
|
||||
console.log(`${colors[color]}${message}${colors.reset}`);
|
||||
// Write to stderr so logs don't interfere with stdout (prompt path/text)
|
||||
console.error(`${colors[color]}${message}${colors.reset}`);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Reference in New Issue