hal.system package

Submodules

hal.system.process module

OS tools

class hal.system.process.Process(cmd)[source]

Bases: object

OS process

execute()[source]

Executes a simple external command

execute_in_background()[source]

Executes a (shell) command in the background

Returns:the process’ pid
get_complex_output(stderr=-2)[source]

Executes a piped command and get the lines of the output in a list

Parameters:stderr – where to put stderr
Returns:output of command
get_exit_code()[source]

Executes the external command and get its exitcode, stdout and stderr

Returns:exit code of command
get_output_from_pipe(input_file)[source]

Executes an external command and get its output. The command receives its input_file from the stdin through a pipe

Parameters:input_file – input file
Returns:output of command
static get_process_list()[source]

Gets the list of running processes

Returns:(generator of) running processes
get_return_code(stderr=-2)[source]

Executes a simple external command and return its exit status

Parameters:stderr – where to put stderr
Returns:return code of command
get_simple_output(stderr=-2)[source]

Executes a simple external command and get its output The command contains no pipes. Error messages are redirected to the standard output by default

Parameters:stderr – where to put stderr
Returns:output of command
keep_alive()[source]

Keeps a process alive. If the process terminates, it will restart it The terminated processes become zombies. They die when their parent terminates