Platforms to show: All Mac Windows Linux Cross-Platform

Back to NSTaskMBS class.

NSTaskMBS.currentDirectoryPath as string

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 task's current directory.

(Read and Write property)

NSTaskMBS.Handle as Integer

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 internal reference to the NSTask object.

(Read and Write property)

NSTaskMBS.isRunning as boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
property Cocoa Tasks MBS MacCocoa Plugin 9.7 ✅ Yes ❌ No ❌ No ❌ No Desktop, Console & Web
Returns whether the receiver is still running.

(Read only property)

NSTaskMBS.launchPath as string

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 path of the receiver's executable.

(Read and Write property)

Some examples using this property:

NSTaskMBS.processIdentifier as Integer

Type Topic Plugin Version macOS Windows Linux iOS Targets
property Cocoa Tasks MBS MacCocoa Plugin 9.7 ✅ Yes ❌ No ❌ No ❌ No Desktop, Console & Web
Returns the receiver's process identifier.
Example
dim args(-1) as string
dim task as NSTaskMBS = NSTaskMBS.launchedTaskWithLaunchPath("/bin/ls", args)

MsgBox "PID: "+str(task.processIdentifier)

(Read only property)

NSTaskMBS.qualityOfService as Integer

Type Topic Plugin Version macOS Windows Linux iOS Targets
property Cocoa Tasks MBS MacCocoa Plugin 15.3 ✅ Yes ❌ No ❌ No ❌ No Desktop, Console & Web
The quality of service setting for this application.

read-only after the task is launched.
(Read and Write property)

NSTaskMBS.terminationReason as Integer

Type Topic Plugin Version macOS Windows Linux iOS Targets
property Cocoa Tasks MBS MacCocoa Plugin 9.7 ✅ Yes ❌ No ❌ No ❌ No Desktop, Console & Web
Returns the reason the task was terminated.
Example
// Launch "ls -l -a -t" in the current directory, and then read the result into a string:

dim args(-1) as string
dim task as NSTaskMBS = NSTaskMBS.launchedTaskWithLaunchPath("/bin/ls", args)

if not task.isRunning then
dim status as Integer = Task.terminationReason

MsgBox "Task termination reason is: "+str(status)
end if

Available in Mac OS X v10.6 and later.

see this constants:
NSTaskTerminationReasonExit = 1The task exited normally.
NSTaskTerminationReasonUncaughtSignal = 2The task exited due to an uncaught signal.
(Read only property)

Some examples using this property:

NSTaskMBS.terminationStatus as Integer

Type Topic Plugin Version macOS Windows Linux iOS Targets
property Cocoa Tasks MBS MacCocoa Plugin 9.7 ✅ Yes ❌ No ❌ No ❌ No Desktop, Console & Web
Returns the exit status returned by the receiver's executable.
Example
// Launch "ls -l -a -t" in the current directory, and then read the result into a string:

dim args(-1) as string
dim task as NSTaskMBS = NSTaskMBS.launchedTaskWithLaunchPath("/bin/ls", args)

if not task.isRunning then
dim status as Integer = Task.terminationStatus

MsgBox "Task return value is: "+str(status)
end if

The exit status returned by the receiver's executable.

Each task defines and documents how its return value should be interpreted. For example, many commands return 0 if they complete successfully or an error code if they don't. You'll need to look at the documentation for that task to learn what values it returns under what circumstances.
This method raises an NSInvalidArgumentException if the receiver is still running. Verify that the receiver is not running before you use it.
(Read only property)

Some examples using this property:

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


The biggest plugin in space...