NSRunningApplication.h: "Not all applications have a pid"
From the com开发者_开发问答ment 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.
精彩评论