From the comment on processIdentifier
in NSRunningApplication.h
:
Not all applications have a pid.
Huh?
I can see this happening in the specific case of an NSRunningApplication
representing a terminated process (runningProcess.terminated == YES
), but I can't think of an example of an running application NOT having a process ID. That's kinda Unix 101.
Documentation bug or am I missing something?
It's a hedge. A "running application" is something that the user thinks of as an application. Shows up in the cmd-tab switcher, etc. That need not necessarily correspond directly to a process. In the classic environment, multiple applications were hosted by a single unix process, classic. In this situation NSRunningApplication would return -1 for each "application".
People who had been at it long enough had seen enough interesting hacks that they thought this was an important thing to define.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With