From 254cf85f26a44b7ca4ab09f1c8cc97064fc41d3d Mon Sep 17 00:00:00 2001 From: catlan Date: Sun, 11 Nov 2007 04:38:42 +0000 Subject: [PATCH] add [NSApplication sharedApplication] to be sure relaucher stay alive and check if pid exists --- relaunch.m | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/relaunch.m b/relaunch.m index ebdae109..489a196a 100644 --- a/relaunch.m +++ b/relaunch.m @@ -27,6 +27,11 @@ // ppid is launchd (1) => parent terminated already [self relaunch]; } + + ProcessSerialNumber psn; + if (GetProcessForPID(ppid, &psn) == procNotFound) { + [self relaunch]; + } } return self; } @@ -53,6 +58,7 @@ int main (int argc, const char * argv[]) NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; + [NSApplication sharedApplication]; [[[TerminationListener alloc] initWithExecutablePath:argv[1] parentProcessId:atoi(argv[2])] autorelease]; [NSApp run];