慕姐4208626
var nwRestart = function () { var child, child_process = require('child_process'); if (process.platform == "darwin") { child = child_process.spawn("open", ["-n", "-a", process.execPath.match(/^([^\0]+?\.app)\//)[1]], { detached: true }); } else { child = child_process.spawn(process.execPath, [], { detached: true }); } child.unref(); require("nw.gui").Window.get().hide(); process._nw_app.quit();};nwRestart();这个适用于比较老的nw客户端,如果使用的nw版本比较新的话,需要相应的修改下,主要是最后的获取nw_app进行退出