Platforms to show: All Mac Windows Linux Cross-Platform
Back to NSTaskMBS class.
NSTaskMBS.arguments as string()
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | Cocoa Tasks | MBS MacCocoa Plugin | 9.7 | ✅ Yes | ❌ No | ❌ No | ❌ No | Desktop, Console & Web |
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | Cocoa Tasks | MBS MacCocoa Plugin | 9.7 | ✅ Yes | ❌ No | ❌ No | ❌ No | Desktop, Console & Web |
On success the handle value is not zero.
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | Cocoa Tasks | MBS MacCocoa Plugin | 15.3 | ✅ Yes | ❌ No | ❌ No | ❌ No | Desktop, Console & Web |
NSTaskMBS.environment as dictionary
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
property | Cocoa Tasks | MBS MacCocoa Plugin | 9.7 | ✅ Yes | ❌ No | ❌ No | ❌ No | Desktop, Console & Web |
The dictionary keys are the environment variable names.
(Read and Write computed property)
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | Cocoa Tasks | MBS MacCocoa Plugin | 9.7 | ✅ Yes | ❌ No | ❌ No | ❌ No | Desktop, Console & Web |
If the task terminates as a result, which is the default behavior, an NSTaskDidTerminateNotification gets sent to the default notification center. This method has no effect if the receiver was already launched and has already finished executing. If the receiver has not been launched yet, this method raises an NSInvalidArgumentException.
It is not always possible to interrupt the receiver because it might be ignoring the interrupt signal. interrupt sends SIGINT.
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | Cocoa Tasks | MBS MacCocoa Plugin | 9.7 | ✅ Yes | ❌ No | ❌ No | ❌ No | Desktop, Console & Web |
Raises an NSInvalidArgumentException if the launch path has not been set or is invalid or if it fails to create a process.
If you get an exception with posix_spawn and error 13, that's a permission denied.
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | Cocoa Tasks | MBS MacCocoa Plugin | 9.7 | ✅ Yes | ❌ No | ❌ No | ❌ No | Desktop, Console & Web |
If multiple suspend messages were sent to the receiver, an equal number of resume messages must be sent before the task resumes execution.
NSTaskMBS.setArguments(arguments() as string)
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | Cocoa Tasks | MBS MacCocoa Plugin | 9.7 | ✅ Yes | ❌ No | ❌ No | ❌ No | Desktop, Console & Web |
NSTaskMBS.setStandardError(p as NSFileHandleMBS)
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | Cocoa Tasks | MBS MacCocoa Plugin | 9.7 | ✅ Yes | ❌ No | ❌ No | ❌ No | Desktop, Console & Web |
This method can be used with NSPipeMBS or NSFileHandleMBS object.
If file is an NSPipe object, launching the receiver automatically closes the write end of the pipe in the current task. Don't create a handle for the pipe and pass that as the argument, or the write end of the pipe won't be closed automatically.
If this method isn't used, the standard error is inherited from the process that created the receiver. This method raises an NSInvalidArgumentException if the receiver has already been launched.
See also:
Some examples using this method:
NSTaskMBS.setStandardError(p as NSPipeMBS)
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | Cocoa Tasks | MBS MacCocoa Plugin | 9.7 | ✅ Yes | ❌ No | ❌ No | ❌ No | Desktop, Console & Web |
This method can be used with NSPipeMBS or NSFileHandleMBS object.
If file is an NSPipe object, launching the receiver automatically closes the write end of the pipe in the current task. Don't create a handle for the pipe and pass that as the argument, or the write end of the pipe won't be closed automatically.
If this method isn't used, the standard error is inherited from the process that created the receiver. This method raises an NSInvalidArgumentException if the receiver has already been launched.
See also:
NSTaskMBS.setStandardInput(p as NSFileHandleMBS)
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | Cocoa Tasks | MBS MacCocoa Plugin | 9.7 | ✅ Yes | ❌ No | ❌ No | ❌ No | Desktop, Console & Web |
file: The standard input for the receiver, which can be either an NSFileHandle or an NSPipe object.
If file is an NSPipe object, launching the receiver automatically closes the read end of the pipe in the current task. Don't create a handle for the pipe and pass that as the argument, or the read end of the pipe won't be closed automatically.
If this method isn't used, the standard input is inherited from the process that created the receiver. This method raises an NSInvalidArgumentException if the receiver has already been launched.
See also:
NSTaskMBS.setStandardInput(p as NSPipeMBS)
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | Cocoa Tasks | MBS MacCocoa Plugin | 9.7 | ✅ Yes | ❌ No | ❌ No | ❌ No | Desktop, Console & Web |
file: The standard input for the receiver, which can be either an NSFileHandle or an NSPipe object.
If file is an NSPipe object, launching the receiver automatically closes the read end of the pipe in the current task. Don't create a handle for the pipe and pass that as the argument, or the read end of the pipe won't be closed automatically.
If this method isn't used, the standard input is inherited from the process that created the receiver. This method raises an NSInvalidArgumentException if the receiver has already been launched.
See also:
NSTaskMBS.setStandardOutput(p as NSFileHandleMBS)
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | Cocoa Tasks | MBS MacCocoa Plugin | 9.7 | ✅ Yes | ❌ No | ❌ No | ❌ No | Desktop, Console & Web |
file: The standard output for the receiver, which can be either an NSFileHandle or an NSPipe object.
If file is an NSPipe object, launching the receiver automatically closes the write end of the pipe in the current task. Don't create a handle for the pipe and pass that as the argument, or the write end of the pipe won't be closed automatically.
If this method isn't used, the standard output is inherited from the process that created the receiver. This method raises an NSInvalidArgumentException if the receiver has already been launched.
See also:
Some examples using this method:
NSTaskMBS.setStandardOutput(p as NSPipeMBS)
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | Cocoa Tasks | MBS MacCocoa Plugin | 9.7 | ✅ Yes | ❌ No | ❌ No | ❌ No | Desktop, Console & Web |
file: The standard output for the receiver, which can be either an NSFileHandle or an NSPipe object.
If file is an NSPipe object, launching the receiver automatically closes the write end of the pipe in the current task. Don't create a handle for the pipe and pass that as the argument, or the write end of the pipe won't be closed automatically.
If this method isn't used, the standard output is inherited from the process that created the receiver. This method raises an NSInvalidArgumentException if the receiver has already been launched.
See also:
NSTaskMBS.standardError as Variant
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | Cocoa Tasks | MBS MacCocoa Plugin | 9.7 | ✅ Yes | ❌ No | ❌ No | ❌ No | Desktop, Console & Web |
The standard error file used by the receiver.
Standard error is where all diagnostic messages are sent. The object returned is either an NSFileHandle or an NSPipe instance, depending on what type of object was passed to setStandardError.
NSTaskMBS.standardInput as Variant
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | Cocoa Tasks | MBS MacCocoa Plugin | 9.7 | ✅ Yes | ❌ No | ❌ No | ❌ No | Desktop, Console & Web |
The standard input file used by the receiver.
Standard input is where the receiver takes its input from unless otherwise specified. The object returned is either an NSFileHandle or an NSPipe instance, depending on what type of object was passed to the setStandardInput method.
NSTaskMBS.standardOutput as Variant
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | Cocoa Tasks | MBS MacCocoa Plugin | 9.7 | ✅ Yes | ❌ No | ❌ No | ❌ No | Desktop, Console & Web |
Standard output is where the receiver displays its output. The object returned is either an NSFileHandle or an NSPipe instance, depending on what type of object was passed to the setStandardOutput method.
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | Cocoa Tasks | MBS MacCocoa Plugin | 9.7 | ✅ Yes | ❌ No | ❌ No | ❌ No | Desktop, Console & Web |
Returns true if the receiver was successfully suspended, false otherwise.
Multiple suspend messages can be sent, but they must be balanced with an equal number of resume messages before the task resumes execution.
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | Cocoa Tasks | MBS MacCocoa Plugin | 9.7 | ✅ Yes | ❌ No | ❌ No | ❌ No | Desktop, Console & Web |
If the task terminates as a result, which is the default behavior, an NSTaskDidTerminateNotification gets sent to the default notification center. This method has no effect if the receiver was already launched and has already finished executing. If the receiver has not been launched yet, this method raises an NSInvalidArgumentException.
It is not always possible to terminate the receiver because it might be ignoring the terminate signal. terminate sends SIGTERM.
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | Cocoa Tasks | MBS MacCocoa Plugin | 9.7 | ✅ Yes | ❌ No | ❌ No | ❌ No | Desktop, Console & Web |
This method first checks to see if the receiver is still running using isRunning. Then it polls the current run loop using NSDefaultRunLoopMode until the task completes.
Some examples using this method:
The items on this page are in the following plugins: MBS MacCocoa Plugin.