Hello Guys,
Is there a way to implement a graceful shutdown the node app?
I'm trying listening to SIGUSR2, but the event doesn't get fired if i kill the "main process" of my node-webkit.
Am i doing something wrong?
How i'm debugging:
#script.js
process.on( 'SIGUSR2', function() {
console.log( "SIGUSR2")
} );
$nw my_folder --remote-debugging-port=9222
$ps aux | grep node-webkit | grep -v grep # show node's webkit "master" process
[...] # a little boot time, my app shows up
$ps aux | grep node-webkit | grep -v grep # show another "slave" process, probably my app
If i send a SIG message to the "master" process:
$kill -SIGUSR2 xxx
My issue is: both processes will quit BUT the event doesn't happen on the node-webkit APP.
In the other hand, if i kill the second ( the "slave" ) one, the event gets fired on my APP's process object, and the "master" seems to die together.
In my case I'm spawning node-webkit, using node.js' spawn function but unfortunately seems like executing "child.kill( 'SIGUSR2' )" will kills the master but the master won't notify the slave process?
thanks in advance,
sorry for the dyslexic email..