In an node.js application I have the following code that is supposed to start a program called timestamp:
var exec = require('child_process').exec, child;
child = exec('./timestamp 207.99.83.228 5000 -p 5500 &', function (error, stdout, stderr) {
if (error !== null) {
console.log('exec error: ' + error);
} else {
// Code to be executed after the timestamp program has started
...
}
});
However, this will not start the timestamp program unless I preceed the call to exec by this:
exec('./timestamp 207.99.83.228 5000 -p 5500 &', null);
If I leave out this line, there is nothing, not even an error message.
So, in order to successfully start one instance of the program, I have to call exec twice. Is that some bug in node.js or the ChildProcess class or am I missing something here?