I have a global npm package that I want to spawn as a process from a NodeJS application.
The problem is that on Windows 10 I have to use the property shell: true
, otherwise I will receive the following error as mentioned here
Error: spawn pm2 ENOENT
The problem is that I don't want to show a new shell on the UI when the command is executed, but rather to be a silent detached process.
My code is the following:
const child: child_process.ChildProcessWithoutNullStreams = child_process.spawn(
command,
args,
{
shell: true,
detached: true,
},
);
child.unref();
Mention
I'm using node v14.15.1
on a Windows 10
machine.
I know that there is a property windowsHide
, but this one is true
by default and is still not working. The shell is still visible.
What should I do to spawn this detached process without showing a new shell on the os UI?