Process 全局对象,可以在代码中的任何位置访问此对象,使用process对象可以截获进程的异常、退出等事件,也可以获取进程的当前目录、环境变量、内存占用等信息,还可以执行进程退出、工作目录切换等操作。

Event:'exit'   当进程准备退出时触发。

process.on('exit', function(code) {
  // do *NOT* do this
  setTimeout(function() {
    console.log('This will not run');
  }, 0);
  console.log('About to exit with code:', code);
});

 

相关文章:

  • 2022-01-15
  • 2021-06-28
  • 2021-08-17
  • 2022-12-23
  • 2021-07-05
  • 2022-01-05
  • 2022-12-23
猜你喜欢
  • 2021-12-20
  • 2022-12-23
  • 2021-06-26
  • 2022-12-23
  • 2022-12-23
  • 2021-05-25
  • 2022-01-05
相关资源
相似解决方案