如何通过服务器端nodejs代码关闭节点webkit应用程序

时间:2014-08-26 09:01:19

标签: javascript node.js node-webkit

我正在使用带有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

0 个答案:

没有答案