我是想让程序在执行完成之前,通过触发一个事件,让node退出进程,我写了几行代码,可是无效退出进程。求高手赐教,谢谢! process.on('exit’, function(code) { console.log('About to exit with code:’, code); });
var num = 100; setInterval(function() { num–; console.log(‘running’); if (num == 50) { process.emit('exit’, function() {}); } }, 100);