Created
June 11, 2015 21:59
-
-
Save adam-lynch/bdb7f74a57f26e30a3fd to your computer and use it in GitHub Desktop.
Testing restarting NW.js app
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thank you!!!