Platforms to show: All Mac Windows Linux Cross-Platform

Back to NSTaskMBS class.

NSTaskMBS.launchedTaskWithLaunchPath(path as string, arguments() as string) as NSTaskMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method Cocoa Tasks MBS MacCocoa Plugin 9.7 ✅ Yes ❌ No ❌ No ❌ No Desktop, Console & Web
Creates and launches a task with a specified executable and arguments.
Example
dim args(-1) as string
dim task as NSTaskMBS = NSTaskMBS.launchedTaskWithLaunchPath("/bin/ls", args)

path: The path to the executable.
arguments: An array of strings that supplies the arguments to the task.

The task inherits its environment from the process that invokes this method.
The NSTask object converts both path and the strings in arguments to appropriate C-style strings (using fileSystemRepresentation) before passing them to the task via argv[]) . The strings in arguments do not undergo shell expansion, so you do not need to do special quoting, and shell variables, such as $PWD, are not resolved.

NSTaskMBS.NSTaskDidTerminateNotification as string

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method Cocoa Tasks MBS MacCocoa Plugin 9.7 ✅ Yes ❌ No ❌ No ❌ No Desktop, Console & Web
The notification name used to notify you that the task terminated.

Posted when the task has stopped execution. This notification can be posted either when the task has exited normally or as a result of terminate being sent to the NSTask object. If the NSTask object gets released, however, this notification will not get sent, as the port the message would have been sent on was released as part of the task release. The observer method can use terminationStatus to determine why the task died. See "Ending an NSTask" for an example.

The notification object is the NSTask object that was terminated. This notification does not contain a userInfo dictionary.

The items on this page are in the following plugins: MBS MacCocoa Plugin.


The biggest plugin in space...