Developer Resources

Process

Overview

The Process class provides functionality for interacting with a system process.

Methods

Process.getPid
Returns the process id associated with a process.
Process.getStandardError
Retrieves the stderr stream of the process
Process.getStandardOutput
Retrieves the stdout stream of the process
Process.isRunning
Determines whether the process is running
Process.kill
Stops a system process
Process.setRedirect
Puts process object in redirect mode
Process.waitForExit
Waits for the process to terminate

Process.getPid

function Process.getPid() : Integer

Returns

Returns the process id for the process represented by this object.

Description

This function returns the process id for the process represented by this object. If no process is associated with the object, the function returns 0.

Process.getStandardError

function Process.getStandardError() : ProcessOutputStream

Description

getStandardError() returns a ProcessOutputStream which allows the caller to retrieve the stderr output of a process.

Process.getStandardOutput

function Process.getStandardError() : ProcessOutputStream

Description

getStandardOutput() returns a ProcessOutputStream which allows the caller to retrieve the stdout contents of a process.

Process.isRunning

function Process.isRunning() : Boolean

Description

After starting a process with start(), calling isRunning() can be used to determine whether the process is still running or not

Process.kill

function Process.kill() : Boolean

Returns

True if the process is successfully stopped, and false otherwise.

Description

This function kills the process associated with this object.

Process.setRedirect

function Process.setRedirect(redirect : Boolean)

Description

Calling this method puts the process object in redirect mode. Redirct mode is useful for capturing the standard output and standard error output text of the process. A call to setRedirect() is necessary in order to use the getStandardOutput() and/or getStandardError() methods. setRedirect() must be called before start() is invoked.

Process.waitForExit

function Process.waitForExit()

Description

After starting a process with start(), calling waitForExit() will block the calling thread until the process has completed execution.