+ launchedTaskWithExecutableURL:arguments:error:terminationHandler:
- init
Availability 有効性
Technology
@interface NSTask : NSObject
Using the NSTask
class, your program can run another program as a subprocess and can monitor that program’s execution.
NSTask
クラスを使うことで、あなたのプログラムは別のプログラムをサブプロセスとして実行できます、そしてそのプログラムの実行を監視することができます。
An NSTask
object creates a separate executable entity; it’s different from NSThread
because it doesn’t 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 needs to change), change the value before your app launches it. Your app can’t change a process’s environment while it’s running.
You can only run an NSTask
object once. Subsequent attempts raise an error.
その後の試みはエラーを引き起こします。
Important 重要
In a sandboxed app, child processes you create with the NSTask
class inherit the sandbox of the parent app. Instead, write helper apps as XPC Services because it allows you to specify different sandbox entitlements for helper apps. For more information, see Daemons and Services Programming Guide and XPC.
+ launchedTaskWithExecutableURL:arguments:error:terminationHandler:
- init
processIdentifier
- launchAndReturnError:
- interrupt
- resume
- suspend
- terminate
- waitUntilExit
running
terminationStatus
terminationReason
arguments
currentDirectoryURL
environment
executableURL
qualityOfService
standardError
standardInput
standardOutput
terminationHandler
NSTaskTerminationReason
NSQualityOfService
NSTaskDidTerminateNotification
+ launchedTaskWithLaunchPath:arguments:
currentDirectoryPath
NSPipe