Process Class Reference

The Process class is used to launch an external process. Processes can be instantiated in the scripting environment. More...

Public Slots

int launch ()
 Launch process. More...
 
int launchAndDetach ()
 Launch process and detach it from application. More...
 
String commandLine ()
 Fetch command line to be executed in this process. More...
 
int errorCode ()
 Fetch error code. More...
 
String & errorMessage ()
 Fetch error message. More...
 
void terminate ()
 Terminate process. More...
 
bool isAlive ()
 Verify if process is still alive. More...
 
int pid ()
 Fetch process PID. More...
 

Public Member Functions

 Process (int pid)
 Create a new Process. A process created with a pid cannot be launched as it already should have been. terminate() and isAlive() functions can still be called with such a process. More...
 
 Process (String name,...)
 Create a new Process. More...
 
 Process (String name, StringList list)
 Create a new Process. More...
 
 Process (String commandLine)
 Create a new Process. More...
 

Detailed Description

The Process class is used to launch an external process. Processes can be instantiated in the scripting environment.

You can use it in both Script Editor and scriptModule.

p1 = new Process( "rndr -t file.rib" ); // create process from single string
p2 = new Process( "rndr", "-t", "file.rib" ); // create process using separate arguments
// Both commands execute same process
p1.launch();
p2.launch();
// Launch a new process and detach it from application.
// Application will not be monitored by script module.
p3 = new Process( "rndr -t file.rib" );
p3.launchAndDetach();
// Create a process from a specified PID.
p4 = new Process( 1234 );
// Verify if process is still alive and terminate it
if ( p4.isAlive() )
{
p4.terminate();
}

Constructor & Destructor Documentation

◆ Process() [1/4]

Process::Process ( int  pid)

Create a new Process. A process created with a pid cannot be launched as it already should have been. terminate() and isAlive() functions can still be called with such a process.

Parameters
intPID of already existing process.

◆ Process() [2/4]

Process::Process ( String  name,
  ... 
)

Create a new Process.

Parameters
namePath or name of process to execute
...List of arguments

◆ Process() [3/4]

Process::Process ( String  name,
StringList  list 
)

Create a new Process.

Parameters
namePath or name of process to execute
listList of arguments

◆ Process() [4/4]

Process::Process ( String  commandLine)

Create a new Process.

Parameters
commandLineEntire command line to launch

Member Function Documentation

◆ commandLine

String Process::commandLine ( )
slot

Fetch command line to be executed in this process.

Returns
command line in a single string

◆ errorCode

int Process::errorCode ( )
slot

Fetch error code.

Returns
error code, zero if none

◆ errorMessage

String& Process::errorMessage ( )
slot

Fetch error message.

Returns
error message associated to error code, empty string if none

◆ isAlive

bool Process::isAlive ( )
slot

Verify if process is still alive.

Returns
state of process, true if it can be reached

◆ launch

int Process::launch ( )
slot

Launch process.

Returns
error code, zero if none

◆ launchAndDetach

int Process::launchAndDetach ( )
slot

Launch process and detach it from application.

Returns
error code, zero if none

◆ pid

int Process::pid ( )
slot

Fetch process PID.

Returns
pid, -1 if no process started

◆ terminate

void Process::terminate ( )
slot

Terminate process.