1 Star 0 Fork 0

pigeatrock / teshehui

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
fork1.js 727 Bytes
一键复制 编辑 原始数据 按行查看 历史
wdeli1995 提交于 2019-08-04 16:53 . 呵呵
var { spawn } = require('child_process');
var path = require('path');
const path_to_entrypoint = path.resolve(require.main.filename);
console.log(`守护进程启动-------------`);
console.log(`开始调用下单进程`);
options = { stdio: ['inherit'] };
child = spawn('./shop_new.exe', [], options);
child.stdout.on('data', (data) => {
console.log(`${data}`);
})
reloadOptions = { stdio: 'inherit' }
child.on('close', (code) => {
if (code == 1) {
console.log(`下单进程异常终止,退出码:${code}`);
console.log(`守护进程重新启动-------------`);
spawn('./shouhu_new.exe', [path_to_entrypoint], reloadOptions);
} else {
console.log(`code: ${code}`);
}
})
1
https://gitee.com/pigeatrock/teshehui.git
git@gitee.com:pigeatrock/teshehui.git
pigeatrock
teshehui
teshehui
master

搜索帮助