Skip to content

Instantly share code, notes, and snippets.

@adam-lynch
Created June 11, 2015 21:59
Show Gist options
  • Save adam-lynch/bdb7f74a57f26e30a3fd to your computer and use it in GitHub Desktop.
Save adam-lynch/bdb7f74a57f26e30a3fd to your computer and use it in GitHub Desktop.
Testing restarting NW.js app
var gui = require("nw.gui"),
child_process = require("child_process"),
win = gui.Window.get(),
child;
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();
win.hide();
gui.App.quit();
Copy link

ghost commented Apr 7, 2016

Thank you!!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment