我正在使用带有child_process.exec进程的nodejs脚本运行webkit
- > server.js
var child = require('child_process').exec('nodewebkit', function(err){
if(err) throw err;
});
代码位于nodewebkit' package.json'的目录中。和' index.html'保留,用于运行nodewebkit app。
这样当我跑
时node server.js
nodewebkit应用程序应该自动启动。
现在,在某些事件中,我想通过相同的脚本关闭当前的nodewebkit应用程序。
怎么做?
编辑:
我尝试了以下内容:
child.kill(); //not working, does not close the app
require('child_process').exec('kill '+child.pid, function(err){}); //doesn't close the app