19Using NSTask

In this section, you will learn:

  • how to create new processes using NSTask,

  • how to send data to the new process' standard in and read data from its standard out and standard error using NSPipe and NSFileHandle, and

  • how NSProcessInfo supplies the program with information about itself.

NSProcessInfo

Your application can access its own process information using the NSProcessInfo object. Here are some of the commonly used methods on NSProcessInfo:

+​ ​(​N​S​P​r​o​c​e​s​s​I​n​f​o​ ​*​)​p​r​o​c​e​s​s​I​n​f​o​

You will use this class method to get hold of the shared instance of NSProcessInfo for the current process.

-​ ​(​N​S​D​i​c​t​i​o​n​a​r​y​ ​*​)​e​n​v​i​r​o​n​m​e​n​t​

Returns a dictionary containing all the environment variables ...

Get Advanced Mac OS X Programming: The Big Nerd Ranch Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.