add [NSApplication sharedApplication] to be sure relaucher stay alive and check if pid exists

This commit is contained in:
catlan committed 2007-11-11 04:38:42 +00:00
1 parent d7cf93dcf4
commit 254cf85f26
1 file changed
+6
+6
View File
@@ -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];