如何解析文本消息错误到对象错误`or`或stderr.pipe with color

发布于 2025-01-30 22:47:05 字数 390 浏览 7 评论 0原文

我正在编写一个框架,我有一个问题:

当我使用.pipe时,从runprocess.stderr of spawn我可以过滤错误消息。 't找到其错误消息颜色,它只是白色,

我如何可以用颜色或解析显示错误消息消息到错误>错误 object(此错误消息是JavaScript的错误消息)

< a href =“ https://i.sstatic.net/5nyse.png” rel =“ nofollow noreferrer”>

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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

随梦而飞# 2025-02-06 22:47:05

您可以通过准备ASCII颜色代码来更改终端中文本的颜色。例如,实例\ u001b [31m会将文本颜色更改为红色。

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

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
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文