Wrong example code for daemon. Printing to stdout without setting it to any file after daemon
goelvivek opened this issue · 2 comments
goelvivek commented
// this code is run twice
// see implementation notes below
console.log(process.pid);
// after this point, we are a daemon
require('daemon')();
//As stdout is closed here. process.pid will not get printed anywhere.
console.log(process.pid);
defunctzombie commented
process.pid will get printed to whatever stdout option you passed to the daemon function. I believe if you don't pass anything, then yes, it won't go anywhere. However you can pass a file stream and that should work.
goelvivek commented
I am getting following output. If I run sample program.
31343
But according to the example code. It should print two pid.