//Create child process
var thread = require('child_process'); var msg = thread.fork(__dirname + '/child.js',['asdasd']); msg.on('message', function (m) { debugger; console.log('PARENT got message:', m); }); msg.on('close', function () { //3 debugger; }) msg.on('disconnect', function () { //1 debugger; }) msg.on('exit', function () { //2 debugger; }) msg.send('asd'); setTimeout(function () { msg.kill(); }, 5000);

  

child.js

process.on('message', function (m,arr) {
    setInterval(function () {
    process.exit(1);
    },2000)
});

  

 

相关文章:

  • 2022-12-23
  • 2021-06-26
  • 2022-12-23
  • 2021-09-24
  • 2022-02-15
  • 2021-07-02
  • 2021-08-25
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-12-12
  • 2021-07-27
  • 2022-02-25
  • 2021-12-12
  • 2021-08-16
相关资源
相似解决方案