Process executes an AppleScript, then disappears. Why/How?
Process executes an AppleScript, then disappears. Why/How?
- Subject: Process executes an AppleScript, then disappears. Why/How?
- From: Jerry Krinock <email@hidden>
- Date: Sun, 13 Jun 2010 12:24:27 -0700
A short-lived "worker" tool is launched by launchd, triggered by a launchd "WatchPath". After determining what needs to be done, this tool executes an NSAppleScript which tells a running application process to do some work. The app does its work, which takes about 15 seconds.
Expected Result: Tool should continue execution with next line of code.
Actual Result: Tool's pid disappears from Activity Monitor immediately after the app completes is script, and no more code is executed.
There is no runLoop in this tool; it simply executes main() from top to bottom. In the launchd plist, I've set the TimeOut and ExitTimeOut keys to integers of 60 seconds, more than enough time for the NSAppleScript to complete. Here is the relevant code in the tool:
NSLog(@"Will execute script") ;
id shouldBeNil = [script executeAndReturnError:&errorInfo] ;
NSLog(@"script return = %@", shouldBeNil) ;
NSLog(@"script error = %@", errorInfo) ;
printf("Did execute script, C print\n") ;
NSLog(@"Did execute script") ;
NSBeep() ;
sleep(10) ;
The console log says "Will execute script", but no more. No NSBeep() either.
What might cause this process to exit? Where can I look for clues? (I've been guessing for two hours, so any suggestion will be welcome.) Does the system log the exit states of processes anywhere?
Thank you,
Jerry Krinock
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden