On Oct 4, 2013, at 12:08 AM, Nick Rogers <roger...@mac.com> wrote:

> Is this even possible?

Basically no. In Unix there is no connection from an executable file to a 
process running that file (or from _any_ file to a process that has that file 
open, really.) The most exhaustive solution is what the `lsof` and `ps` tools 
do, basically iterating over the kernel’s list of open files and running 
processes and looking for a match, which is expensive.

Unix tools often seem to use a strategy of creating a ‘pid’ file at some known 
location, which contains the process ID of the running instance of the tool. 
The tool has to write the file when it starts up, and be careful to delete it 
whenever it exits (including if it crashes or is killed.)

But I agree with Kyle, you should be using XPC or something similar to manage 
helper tasks.

—Jens
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to