On 25 Jul 08, at 22:58, Sumner Trammell wrote:
Hi. A daemon process is running independently of my Cocoa app. Given a pid file of the daemon process in a known location, say /var/run/ somedaemon.pid, I would like my Cocoa app to read that file and check the process table to see if the daemon is actually running. If the daemon IS running, I want my
Cocoa app to change its Dock icon.
Is there a canonical Cocoa way of doing this? Using NSTask and NSPipe to run
/bin/ps seems like a kludge.

Not Cocoa, but take a look at what the kill() syscall does when given a signal of 0. This won't let you check WHAT process is running, but it will let you check whether SOME process is running with that PID, which is generally good enough.
_______________________________________________

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

This email sent to [EMAIL PROTECTED]

Reply via email to