Reputation: 5030
My macOS app can launch a faceless helper application which is shipped in its Contents/Library/LoginItems
using Apple's Service Management Framework, as described in Apple documentation. Funny thing is, when I request the unix ps
program to give me the command/paths, for this helper process, it gives the bundle identifier instead. Example:
jk$ ps -x -o command
...
com.mycompany.MyAgent
...
It gives me the same answer with or without the -c
option on ps
.
Because my app comes in several flavors and versions which each contain different helpers, and because users may have multiple installations, and because of the sometimes strange behavior of Launch Services, for self-testing and diagnostic purposes, I would like to get the path to the running helper's package or executable.
Why does ps
give the bundle identifier instead? How can I get the path?
Upvotes: 0
Views: 161
Reputation: 90681
A program can a) rewrite the memory pointed to by argv
and the strings it points to, and/or b) call setprogname()
.
I seem to recall that setprogname()
does not affect the output of ps
, but rewriting argv
does. I could have that backwards, though. I know that Wine does both and affects the command that ps
sees.
Upvotes: 1