2024-10-02 19:10:44 -07:00
|
|
|
const childProcess = require('node:child_process');
|
2023-06-15 16:42:27 +02:00
|
|
|
const path = require('node:path');
|
2016-03-28 14:00:41 -07:00
|
|
|
|
2016-03-25 13:03:49 -07:00
|
|
|
process.on('uncaughtException', function (error) {
|
|
|
|
process.send(error.stack);
|
|
|
|
});
|
2013-09-05 09:21:39 +08:00
|
|
|
|
2024-10-02 19:10:44 -07:00
|
|
|
const child = childProcess.fork(path.join(__dirname, '/ping.js'));
|
|
|
|
|
2016-03-25 13:03:49 -07:00
|
|
|
process.on('message', function (msg) {
|
|
|
|
child.send(msg);
|
|
|
|
});
|
2013-09-05 09:21:39 +08:00
|
|
|
child.on('message', function (msg) {
|
2016-03-25 13:03:49 -07:00
|
|
|
process.send(msg);
|
|
|
|
});
|
|
|
|
child.on('exit', function (code) {
|
|
|
|
process.exit(code);
|
|
|
|
});
|