Home > Enterprise >  How to parse text message error to object Error `or` stderr.pipe with color
How to parse text message error to object Error `or` stderr.pipe with color

Time:05-22

I'm writing a framework I have a problem:

When i use .pipe to filter the error message from runProcess.stderr of spawn i can't find its error message color and it's just white

How can i display error message with color or parse message into Error object (this error message is Error message of javascript)

enter image description here

CodePudding user response:

You can change the color of text in the terminal by prepending an ascii color code. For instance \u001b[31m would change the text color to red.

console.log("\u001b[31mHello World");
// Will print "Hello World" in red

CodePudding user response:

I need it to look like this from string

example

  • Related