Libraries
Process Source Code
 previous   up   next 

Types
process
Type to manage processes.

process

const type: process

Type to manage processes.


Operator Summary
void
(attr process) . value
Default value of process (process.EMPTY).
boolean
(in process: process1) = (in process: process2)
Check if two processes are equal.
boolean
(in process: process1) <> (in process: process2)
Check if two processes are not equal.

Function Summary
integer
compare (in process: process1, in process: process2)
Compare two process values.
integer
hashCode (in process: aProcess)
Compute the hash value of a process.
string
str (in process: aProcess)
Convert a process to a string.
boolean
isAlive (in process: process1)
Test whether the specified process is alive.
process
startProcess (in string: command, in array string: parameters)
Start a new process.
process
startProcess (in var string: cmdAndParams)
Start a new process.
file
childStdIn (in process: aProcess)
Returns the standard input file (stdin) of the given child process.
file
childStdOut (in process: aProcess)
Returns the standard output file (stdout) of the given child process.
file
childStdErr (in process: aProcess)
Returns the error output file (stderr) of the given child process.
void
kill (in process: aProcess)
Kill the specified process.
void
waitFor (in process: aProcess)
Wait until the specified child process has terminated.
integer
exitValue (in process: aProcess)
Return the exit value of the specified process.
array string
getSearchPath
Returns the search path of the system as array of strings.
void
setSearchPath (in array string: searchPath)
Sets the search path from an array of strings.
string
commandPath (in string: command)
Search for an executable in the directories of the search path.
string
commandDir (in string: command)
Search for the directory of an executable in the search path.
void
pipe2 (in string: command, in array string: parameters, inout file: childStdin, inout file: childStdout)
Start a process and connect pipes to its standard I/O files.

Operator Detail

. value

const process: (attr process) . value

Default value of process (process.EMPTY).


=

const func boolean: (in process: process1) = (in process: process2)

Check if two processes are equal. Processes are compared with the process identifier (PID).

Returns:
TRUE if the two processes are equal, FALSE otherwise.

<>

const func boolean: (in process: process1) <> (in process: process2)

Check if two processes are not equal. Processes are compared with the process identifier (PID).

Returns:
TRUE if both processes are not equal, FALSE otherwise.

Function Detail

compare

const func integer: compare (in process: process1, in process: process2)

Compare two process values. The order of two processes is determined by comparing the process identifiers (PID). Therefore the result of compare may change if the program is executed again. Inside a program the result of compare is consistent and can be used to maintain hash tables.

Returns:
-1, 0 or 1 if the first argument is considered to be respectively less than, equal to, or greater than the second.

hashCode

const func integer: hashCode (in process: aProcess)

Compute the hash value of a process.

Returns:
the hash value.

str

const func string: str (in process: aProcess)

Convert a process to a string. The process is converted to a string with the process identifier (PID).

Returns:
the string result of the conversion.
Raises:
MEMORY_ERROR - Not enough memory to represent the result.

isAlive

const func boolean: isAlive (in process: process1)

Test whether the specified process is alive.

Returns:
TRUE if the specified process has not yet terminated, FALSE otherwise.

startProcess

const func process: startProcess (in string: command, in array string: parameters)

Start a new process. The command path must lead to an executable file. The environment variable PATH is not used to search for an executable.

Parameters:
command - Name of the command to be executed. A path must use the standard path representation.
parameters - Array of argument strings passed to the new program.
Returns:
the process that has been started.
Raises:
MEMORY_ERROR - Not enough memory to convert 'command' to the system path type.
RANGE_ERROR - 'command' is not representable in the system path type.
FILE_ERROR - The file does not exist or does not have execute permission.

startProcess

const func process: startProcess (in var string: cmdAndParams)

Start a new process. The command path must lead to an executable file. The environment variable PATH is not used to search for an executable.

Parameters:
cmdAndParams - Command to be executed and optional space separated list of parameters. Command and parameters must be space separated.
Returns:
the process that has been started.
Raises:
MEMORY_ERROR - Not enough memory to convert 'command' to the system path type.
RANGE_ERROR - 'command' is not representable in the system path type.
FILE_ERROR - The file does not exist or does not have execute permission.

childStdIn

const func file: childStdIn (in process: aProcess)

Returns the standard input file (stdin) of the given child process. If the standard input file of the subprocess has been redirected then this function will return NULL.

Returns:
the standard input file of 'aProcess' or STD_NULL, if stdin has been redirected.

childStdOut

const func file: childStdOut (in process: aProcess)

Returns the standard output file (stdout) of the given child process. If the standard output file of the subprocess has been redirected then this function will return NULL.

Returns:
the standard output file of 'aProcess' or STD_NULL, if stdout has been redirected.

childStdErr

const func file: childStdErr (in process: aProcess)

Returns the error output file (stderr) of the given child process. If the standard error file of the subprocess has been redirected then this function will return NULL.

Returns:
the error output file of 'aProcess' or STD_NULL, if stderr has been redirected.

kill

const proc: kill (in process: aProcess)

Kill the specified process.

Raises:
FILE_ERROR - It was not possible to kill the process.

waitFor

const proc: waitFor (in process: aProcess)

Wait until the specified child process has terminated. Suspend the execution of the calling process until the specified child has terminated.


exitValue

const func integer: exitValue (in process: aProcess)

Return the exit value of the specified process. By convention, the value 0 indicates normal termination.

Returns:
the exit value of the specified process.
Raises:
FILE_ERROR - The process has not yet terminated.

getSearchPath

const func array string: getSearchPath

Returns the search path of the system as array of strings.

Returns:
the search path of the system.
Raises:
MEMORY_ERROR - Not enough memory to create the result.

setSearchPath

const proc: setSearchPath (in array string: searchPath)

Sets the search path from an array of strings. The search path is used by the current process and its sub processes. The path of parent processes is not affected by this function.

Raises:
MEMORY_ERROR - Not enough memory to convert the path to the system string type.
RANGE_ERROR - The path cannot be converted to the system string type or a system function returns an error.

commandPath

const func string: commandPath (in string: command)

Search for an executable in the directories of the search path.

Returns:
the absolute path of the executable or "" if the executable was not found.

commandDir

const func string: commandDir (in string: command)

Search for the directory of an executable in the search path.

Returns:
the absolute path of the directory of the executable or "" if the executable was not found.

pipe2

const proc: pipe2 (in string: command, in array string: parameters, inout file: childStdin, inout file: childStdout)

Start a process and connect pipes to its standard I/O files. The command path must lead to an executable file. The environment variable PATH is not used to search for an executable. Pipe2 can be used to execute programs which process a stream of data. Interactive programs buffer their I/O if they are not connected to a terminal. Pipe2 has no influence of the buffering of the executed command. Therefore interactive programs might not work correctly with pipe2.

Raises:
MEMORY_ERROR - Not enough memory to convert 'command' to the system path type.
RANGE_ERROR - 'command' is not representable in the system path type.
FILE_ERROR - The file does not exist or does not have execute permission.


 previous   up   next