Relaunch an application


/ Published in: Objective C
Save to your folder(s)

The application that needs to be restarted must fork 'relaunch' with two arguments, then terminate. In Cocoa, the fork is easily achieved with a NSTask. The first argument must be the path to the application to relaunch. The second argument must be the process identifier of the terminating application. In Cocoa, you can get it with [[NSProcessInfo processInfo] processIdentifier], which is equivalent to getpid().

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.