Exemplo n.º 1
0
        public static void Relaunch(this NSApplication self)
        {
            var pid    = NSProcessInfo.ProcessInfo.ProcessIdentifier;
            var script = string.Format(@"
                while [ `ps -p {0} | wc -l` -gt 1 ]; do sleep 0.1; done; open '{1}'
            ", pid, NSBundle.MainBundle.BundlePath);

            NSTask.LaunchFromPath("/bin/sh", new [] { "-c", script });
            self.Terminate(self);
        }