Who is launching my helper?
Who is launching my helper?
- Subject: Who is launching my helper?
- From: Jerry Krinock <email@hidden>
- Date: Tue, 20 Jan 2015 15:29:07 -0800
My OS X app includes a helper command-line tool, packed in the the app’s Contents/Helpers folder. The helper tool is intended to be launched by launchd, in response to a launchd agent being triggered. The agent provides five (5) command-line arguments to the tool. The tool runs for a few seconds to a minute to do some work, then terminates itself. This all works great for me, and for most users most of the time.
If the helper tool gets bad arguments, it logs and displays to the user an error indication. During the last few months, possibly since Yosemite, this has occurred and been reported to me by users a half dozen times. The error in their logs indicates that the parent process invoking my helper is, unfortunately, launchd, so that doesn’t tell me much. It also says that it is receiving two arguments instead of five, and that these two arguments are
1. As expected, the path to the tool.
2. -psn_0_430185 (for example)
Regarding the second argument, I’ve seen this before. I know it is a process serial number, but when I launch my *app* by doubleclicking in Finder, I don’t get a -psn argument. Does the presence of the -psn argument give me any clues as to how or why my helper is being invoked?
A couple more clues, from one user…
He told me that the error occurred during login after a restart. It is rare, but part of my design, that if my helper is in the middle of a job and gets terminated due to user logging out, a fail-safe “standby" launchd agent will remain and, the next time the user logs in, will relaunch my tool, properly, with five arguments. I’ve retested this mechanism recently and, for me, it works fine. The tool runs, re-does it work, and terminates itself.
This user also sent a screenshot showing that, after he dismissed the error, a blue *folder* icon named “Helpers” showed up in his ⌘-tab application switcher! Believe it:
Bigger: https://www.flickr.com/photos/113343850@N03/16143184547/
I presume that this is related to my tool, because of my “Contents/Helpers”. “Helpers" is not a common folder name. How could OS X get the crazy idea that my app’s Contents/Helpers folder belongs in the application switcher? Has anyone ever seen a folder in there like that?
Whenever a user reports something totally off the wall like this, I look in their logs for evidence of any code-injecting hacks, SIMBL in particular. (SIMBL is still around; just caught one last week!) But I’ve not seen any such hacks in logs from users with this issue.
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