Process

Process related things.


GetProcessID

function GetProcessID: TProcessID;

Returns the process ID of the running script.


GetProcessArgs

function GetProcessArgs: TStringArray;

Returns all process arguments.


GetProcessArg

function GetProcessArg(Key: String): String;

Argument should be passed as a key-pair value: Name=Value


IsProcessRunning

function IsProcessRunning(PID: TProcessID): Boolean;

IsProcess64Bit

function IsProcess64Bit(PID: TProcessID): Boolean;

GetProcessPath

function GetProcessPath(PID: TProcessID): String;

GetProcessMemUsage

function GetProcessMemUsage(PID: TProcessID): Int64;

GetProcessStartTime

function GetProcessStartTime(PID: TProcessID): TDateTime;

GetProcessAge

function GetProcessAge(PID: TProcessID): UInt64;

TerminateProcess

procedure TerminateProcess(PID: TProcessID);

GetEnvVar

function GetEnvVar(Name: String): String

GetEnvVars

function GetEnvVars: TStringArray

TRunningProcess.Free


TRunningProcess.WaitOnExit

function WaitOnExit: Boolean; overload;
function WaitOnExit(Timeout: Integer): Boolean; overload;

TRunningProcess.Terminate

function Terminate(AExitCode: Integer): Boolean;

TRunningProcess.Running

property TRunningProcess.Running: Boolean

TRunningProcess.PID

property TRunningProcess.PID: TProcessID

TRunningProcess.ExitCode

property TRunningProcess.ExitCode: TProcessExitCode

TRunningProcessPiped.Read

function TRunningProcessPiped.Read(Buf: PByte; Count: Integer): Integer;

TRunningProcessPiped.ReadString

function TRunningProcessPiped.ReadString: String;

TRunningProcessPiped.Write

function TRunningProcessPiped.Write(Buf: PByte; Count: Integer): Integer;

TRunningProcessPiped.WriteString

function TRunningProcessPiped.WriteString(Str: String): Integer;

TRunningProcessPiped.ReadBytesAvailable

property TRunningProcessPiped.ReadBytesAvailable: Integer

StartProcess

function StartProcess(Executable: String; Params: TStringArray): TRunningProcess;
function StartProcess(Executable: String; Params: TStringArray; Cwd: String; Env: TStringArray = []): TRunningProcess;

StartProcessPiped

function StartProcessPiped(Executable: String; Params: TStringArray): TRunningProcessPiped;
function StartProcessPiped(Executable: String; Params: TStringArray; Cwd: String; Env: TStringArray = []): TRunningProcessPiped;

RunProcess

function RunProcess(Executable: String; Params: TStringArray): TProcessExitCode;
function RunProcess(Executable: String; Params: TStringArray; out Output: String): TProcessExitCode;

RunSimbaScript

function RunSimbaScript(Script: String; Parameters: TStringArray): TProcessExitStatus;
function RunSimbaScript(Script: String; Parameters: TStringArray; out Output: String): TProcessExitStatus;

Runs a simba script and will wait until the script has finished.


StartSimbaScript

function StartSimbaScript(Script: String; Params: TStringArray): TRunningProcess;

Start a simba script.


StartSimbaScriptPiped

function StartSimbaScriptPiped(Script: String; Params: TStringArray): TRunningProcessPiped;

Start a simba script (with piped input & output)