How does one pipe stdout to a parent process' stdout?

87 Views Asked by At

I'm not sure if this is specific to npm scripts, or to visual studio code, or to shell scripting in general so please bear with me.

The setup is like this. I have a react project running through Visual Studio Code on a windows environment and in the scripts section of my package.json file I have custom script that looks like this

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

For the sake of simplicity, lets just say the prestart.sh file looks like this

echo "Hello World"
sleep 10
exit

What happens when I run "npm start" is that "prestart.sh" runs then "react-scripts start" runs. This is exactly what I want. The problem is that, in my environment, the Visual Studio Code terminal is spawning a \Git\bin\bash console to run the shell script and the echos are all showing up on that spawned console. I would like them to just show up on the Visual Studio Code terminal or output tabs.

enter image description here

Is there a way to pipe the echos from the prestart.sh script into the terminal or output tabs for Visual Studio? If there is, how do I do it?

0

There are 0 best solutions below