This object allows you to start and manage a process. (program)
Constructor function.
var myObject = new Process();
var myObject = new Process(parameters);
var myObject = new Process();
var myObject = new Process({ workingDirectory: "/home/user", onStarted: function() { Console.print("Started!"); }, onFinished: function() { Console.print("Finished!"); } });
Returns an array of ProcessHandle linked to all running processes.
Process.list();
Returns a ProcessHandle linked to the Actionaz process.
Process.thisProcess();
Starts a process in detached mode and returns a ProcessHandle linked to it. You will have lesser control on the process than in attached mode, but it will be independent of the current execution.
Process.startDetached(filename);
Process.startDetached(filename, parameters);
Process.startDetached(filename, parameters, workingDirectory);
Returns a ProcessHandle linked to the started process
myObject.handle();
Returns the process id of the started process.
myObject.id();
Starts the process.
myObject.start(filename);
myObject.start(filename, parameters);
myObject.start(filename, parameters, openMode);
Returns the state of the started process.
myObject.state();
Returns the error state of the started process.
myObject.error();
Returns the process's exit code.
myObject.exitCode();
Returns the process's exit status.
myObject.exitStatus();
Returns the content of the standard error output as a RawData.
myObject.readError();
Returns the content of the standard output as a RawData.
myObject.read();
Returns the content of the standard error output as text.
myObject.readErrorText();
myObject.readErrorText(encoding);
Returns the content of the standard output as text.
myObject.readText();
myObject.readText(encoding);
Returns true if the process is not running and if no data can be read.
myObject.atEnd();
Returns the number of bytes that can be read.
myObject.bytesAvailable();
Returns the number of bytes that are still to be written.
myObject.bytesToWrite();
Returns true if a line can be read.
myObject.canReadLine();
Writes some data to the process.
myObject.write(data);
Writes text to the process.
myObject.writeText(text, encoding);
Sets the working directory. This only works when the process is not already started.
myObject.setWorkingDirectory(workingDirectory);
Sets process's channel mode. This only works when the process is not already started.
myObject.setProcessChannelMode(channelMode);
Sets the process's environment variables. This only works when the process is not already started.
myObject.setEnvironment(environment);
myObject.setEnvironment({ PATH: "c:\\;c:\\path", MYVAR: "hello" });
Updates the process's environment variables. This only works when the process is not already started.
myObject.updateEnvironment(environment);
myObject.updateEnvironment({ PATH: "c:\\;c:\\path", MYVAR: "hello" });
Sets process's read channel.
myObject.setReadChannel(channel);
Sets the standard error file.
myObject.setStandardErrorFile(fileName);
myObject.setStandardErrorFile(fileName, openMode);
Sets the standard input file.
myObject.setStandardInputFile(fileName);
Sets the standard output file.
myObject.setStandardOutputFile(fileName);
myObject.setStandardOutputFile(fileName, openMode);
Sets the standard output process.
myObject.setStandardOutputFile(process);
Freezes the execution until the process has finished.
myObject.waitForFinished(waitTime);
myObject.waitForFinished();
Freezes the execution until the process has started.
myObject.waitForStarted(waitTime);
myObject.waitForStarted();
Freezes the execution until the data has been written.
myObject.waitForBytesWritten(waitTime);
myObject.waitForBytesWritten();
Freezes the execution until data is available.
myObject.waitForReadyRead(waitTime);
myObject.waitForReadyRead();
Tries to close the process gracefully.
myObject.close();
Kills the process.
myObject.kill();
Terminates the process.
myObject.terminate();
Called when an error occured.
myObject.onError = function(processError) {};
myObject.onError = function(processError) { //Event action };
Called when the process has finished.
myObject.onFinished = function(exitCode, exitStatus) {};
myObject.onFinished = function(exitCode, exitStatus) { //Event action };
Called when there is data available on the standard error output.
myObject.onReadyReadStandardError = function() {};
myObject.onReadyReadStandardError = function() { //Event action };
Called when there is data available on the standard output.
myObject.onReadyReadStandardOutput = function() {};
myObject.onReadyReadStandardOutput = function() { //Event action };
Called when the process has started executing.
myObject.onStarted = function() {};
myObject.onStarted = function() { //Event action };
Called when the process's state has changed.
myObject.onStateChanged = function(newState) {};
myObject.onStateChanged = function(newState) { //Event action };
A process error.
The process's exit status.
The process's status.
A process's channel.
A process's channel mode.
A process's channel open mode.