node.js能检测到它closures吗?

我想知道是否有可能通过在Windows上单击“X”来检测node.js进程何时closures。 如果是的话那么怎么样 我试过process.on("exit"); 但是这并没有奏效。

抓住SIGHUP

 /* * Run this code and close the Window before the 10 seconds */ var x = setTimeout(function() { console.log('hello world') }, 10000); process.on('SIGHUP', function() { console.log('About to exit'); process.exit(); });