-
-
Save mortenjust/8ab8eb3774a02ac27c7cefc0af5c5244 to your computer and use it in GitHub Desktop.
Self relaunch of Cocoa application (Swift version of https://gist.github.com/cdfmr/2204627)
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
let task = Process() | |
var args = [String]() | |
args.append("-c") | |
let bundle = Bundle.main.bundlePath | |
args.append("sleep 0.2; open \"\(bundle)\"") | |
task.launchPath = "/bin/sh" | |
task.arguments = args | |
task.launch() | |
NSApplication.shared().terminate(nil) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Swift 4 version: https://gist.github.com/BenLeggiero/449fb9b1a45b69fb276f4f9ad86cab7a