An object representing a subprocess of the current process.
- macOS 10.0+
NSTask class, your program can run another program as a subprocess and can monitor that program’s execution. A
NSTask object creates a separate executable entity; it differs from
NSThread in that it does not share memory space with the process that creates it.
A process operates within an environment defined by the current values for several items: the current directory, standard input, standard output, standard error, and the values of any environment variables. By default, an
NSTask object inherits its environment from the process that launches it. If there are any values that should be different for the process, for example, if the current directory should change, you must change the value before you launch it. A process's environment cannot be changed while it is running.
NSTask object can only be run once. Subsequent attempts raise an error.