class PROCESS_POSIX
Summary
This class allows one to spawn an external process and make it execute some file.
The standard streams of the process are available: input, output and error.
Note: This class is in a beta stage, there may be resource leaks or other bugs left.
Direct parents
Inherit list: DISPOSABLE, PROCESS
Class invariant
Overview
Creation features
{ANY}
Features
{ANY}
{PROCESS_GROUP}
{}
plugin low-level data
{EXEC_INPUT_STREAM_POSIX, EXEC_OUTPUT_STREAM_POSIX}
plugin features
{}
{ANY}
{}
{ANY}
  • is_equal (other: PROCESS_POSIX): BOOLEAN
    Is other attached to an object considered equal to current object?
effective function
{ANY}
require
  • is_connected
  • not is_child
is_child: BOOLEAN
effective function
{ANY}
is_connected: BOOLEAN
writable attribute
{ANY}
require
  • not is_child
is_finished: BOOLEAN
effective function
{ANY}
require
  • is_connected
  • not is_child
status: INTEGER_32
effective function
{ANY}
require
  • is_finished
  • not is_child
wait
effective procedure
{ANY}
require
  • is_connected
  • not is_child
ensure
  • is_finished
  • input /= Void implies not input.is_connected
  • output /= Void implies not output.is_connected
  • error /= Void implies not error.is_connected
kill (signal: INTEGER_32)
effective procedure
{ANY}
require
writable attribute
{ANY}
You can feed data to the process by this channel
require
  • not is_child
output: INPUT_STREAM
writable attribute
{ANY}
You can read data from the process by this channel
require
  • not is_child
error: INPUT_STREAM
writable attribute
{ANY}
You can read error data from the process by this channel
require
  • not is_child
execute (program: STRING, arguments: TRAVERSABLE[STRING], keep_environment: BOOLEAN)
effective procedure
{ANY}
Execute the given program (how the program is discovered is OS-dependent), passing to it the arguments.
The environment is cleared if keep_environment is False.
require
  • program /= Void
  • is_ready
execute_command_line (command_line: STRING, keep_environment: BOOLEAN)
effective procedure
{ANY}
Execute the command_line through the operating system's basic shell.
The environment is cleared if keep_environment is False.
See also: SYSTEM.execute_command
require
  • command_line /= Void
  • not command_line.is_empty
  • is_ready
duplicate
effective procedure
{ANY}
Duplicate the running process so that two processes are running simultaneously with the same code and starting from the same data (inspired from the fork(2) POSIX call)
require
  • is_ready
writable attribute
{ANY}
cleanup (stat: INTEGER_32)
effective procedure
dispose
effective procedure
{}
Action to be executed just before garbage collection reclaims an object.
do_cleanup
effective procedure
{}
make
effective procedure
{}
writable attribute
{}
writable attribute
{}
writable attribute
{}
do_execute (program: POINTER, program_arguments: POINTER, keep_environment: BOOLEAN, additional_env: POINTER)
effective procedure
{}
require
basic_exec_posix_execute (dat: POINTER, program: POINTER, arguments: POINTER, keep_environment: BOOLEAN, add_environment: POINTER, in_fd: POINTER, out_fd: POINTER, err_fd: POINTER): BOOLEAN
{}
basic_exec_id (dat: POINTER): INTEGER_32
{}
basic_exec_is_child (dat: POINTER): BOOLEAN
{}
basic_exec_alloc_data: POINTER
{}
basic_exec_free_data (dat: POINTER)
{}
basic_exec_is_finished (dat: POINTER): BOOLEAN
{}
basic_exec_status (dat: POINTER): INTEGER_32
{}
basic_exec_wait (dat: POINTER)
{}
basic_exec_cleanup (dat: POINTER, stat: INTEGER_32)
{}
basic_exec_posix_kill (dat: POINTER, signal: INTEGER_32)
{}
set_group (group_: PROCESS_GROUP)
effective procedure
{ANY}
require
  • group_ /= Void
ensure
is_ready: BOOLEAN
effective function
{ANY}
ensure
direct_input: BOOLEAN
writable attribute
{ANY}
Is the program's input stream read directly from the standard input stream rather than from input?
set_direct_input (direct_input_: BOOLEAN)
effective procedure
{ANY}
ensure
direct_output: BOOLEAN
writable attribute
{ANY}
Is the program's output stream sent directly to the standard output stream rather than to output?
set_direct_output (direct_output_: BOOLEAN)
effective procedure
{ANY}
ensure
direct_error: BOOLEAN
writable attribute
{ANY}
Is the program's error stream sent directly to the standard error stream rather than to error?
set_direct_error (direct_error_: BOOLEAN)
effective procedure
{ANY}
ensure
hash_code: INTEGER_32
effective function
{ANY}
The hash-code value of Current.
ensure
  • good_hash_value: Result >= 0
cleanup_streams
effective procedure
{}
is_equal (other: PROCESS_POSIX): BOOLEAN
deferred function
{ANY}
Is other attached to an object considered equal to current object?
require
  • other /= Void
ensure
  • Result implies hash_code = other.hash_code
  • commutative: generating_type = other.generating_type implies Result = other.is_equal(Current)