electron/spec/fixtures/module/fork_ping.js

17 lines
380 B
JavaScript
Raw Normal View History

2020-03-20 13:28:31 -07:00
const path = require('path');
2016-03-25 13:03:49 -07:00
process.on('uncaughtException', function (error) {
2020-03-20 13:28:31 -07:00
process.send(error.stack);
});
2013-09-05 09:21:39 +08:00
2020-03-20 13:28:31 -07:00
const child = require('child_process').fork(path.join(__dirname, '/ping.js'));
2016-03-25 13:03:49 -07:00
process.on('message', function (msg) {
2020-03-20 13:28:31 -07:00
child.send(msg);
});
2013-09-05 09:21:39 +08:00
child.on('message', function (msg) {
2020-03-20 13:28:31 -07:00
process.send(msg);
});
2016-03-25 13:03:49 -07:00
child.on('exit', function (code) {
2020-03-20 13:28:31 -07:00
process.exit(code);
});