Using the NSTask Class

The NSTask class can be used to launch another process. In conjunction with other Cocoa classes, such as NSPipe, it can also set up communications between your program and the launched NSTask. To understand what facilities are available, it is instructive to first consider some of the ways you can communicate with another process.

Each process can take input from its environment variables, command-line arguments, files, and stdin (standard input). It can send output to a file, stdout (standard output), or stderr (standard error). Each process also has an integer return value, which is normally set to zero when a process exits successfully. Processes can also open up Unix pipes and sockets to communicate with each other. ...

Get Cocoa® Programming 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.