如何将一个管道标准输出连接到父进程的标准输出?

问题描述

我不确定这是否特定于npm脚本,Visual Studio代码或一般来说是Shell脚本,所以请耐心等待。

设置是这样的。我有一个在Windows环境中通过Visual Studio Code运行的react项目,并且在package.json文件的scripts部分中,我有一个类似于以下的自定义脚本

 "scripts": {
    "prestart": "prestart.sh","start": "react-scripts start",//Rest of the scripts
  },

为简单起见,我们只说prestart.sh文件如下

echo "Hello World"
sleep 10
exit

当我运行“ npm start”时,发生的是先运行“ prestart.sh”,然后运行“ react-scripts start”。这正是我想要的。问题是,在我的环境中,Visual Studio Code终端生成一个\ Git \ bin \ bash控制台来运行Shell脚本,并且所有回显都显示在该生成的控制台上。我希望它们只显示在Visual Studio Code终端或“输出”选项卡上。

enter image description here

是否可以通过管道将prestart.sh脚本中的回显传递到Visual Studio的终端或输出选项卡中?如果有,该怎么办?

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)