I have a simple issue involding child_proccess. If you call child_process from a script its going to run that command in that script. If you export a function that runs the command, for what i've tested, it tries to run the command in the library terminal and not the current terminal.
Example:
Lets say you have your script a.js that you export to b.js and in a.js you have this function called hello that prints "Hello World" with the echo command:
//a.js
export function hello(){
child_process.execSync("echo Hello World");
}
import {hello} from "a.js"
hello();
When you run it it will not send you anything. If you print "Hello World" with console.log() it will return it in the current terminal. Is there a way to execute a cmd command in the current terminal?
The command is actually running on the same terminal. Since you have not asked the child_process to direct the stdout to the current terminal, it does not print anything.
//a.js
export function hello(){
child_process.execSync("echo Hello World",{stdio:"inherit"});
}
This should work fine.