I've followed the instructions in the api docs as far as I can tell. I spawn the process, using the options detached:true, stdio:['ignore','ignore','ignore']
, I call unref
on the ChildProcess. The ChildProcess has a pid, so I think it was successfully started. I'm trying to start a yeti server from within a grunt task. This code is within an async call, so next
proceeds and eventually finishes the task. I use which
to getcmd
, and its the correct path to the yeti script in /usr/local/bin
on Mac OSX 10.9. Port is also defined to an empty port. If I run the same command on the command line it works just fine. After the grunt exits I call ps aux | grep node
and ps aux
and grep for the logged pid and there is nothing running. Here is the code:
yeti = spawn("" + cmd + " --server --port " + port, [], {
detached: true,
stdio: ['ignore', 'ignore', 'ignore']
});
yeti.unref();
next("Yeti server is running. pid: " + yeti.pid);