class documentation

class PythonRunner:

Constructor: PythonRunner()

View In Hierarchy

A class for running programs asynchronously.

This class provides methods to start and stop python programs It captures the program's standard output and provides methods to check the execution status and retrieve the program output.

Method __init__ Initialize the ProgramRunner.
Method start Start the specified program.
Method stop Stop the currently running program.
Property exit_status Get the exit status of the executed program.
Property is_running Check if a program is currently running.
Property output Get the standard output of the executed program.
Instance Variable __execution_lock Undocumented
Instance Variable __output Undocumented
Instance Variable __process Undocumented
def __init__(self):

Initialize the ProgramRunner.

def start(self, program_path: str, execution_started_event: Event = None):

Start the specified program.

Parameters
program_path:strThe path to the program file to be executed.
execution_started_event:EventAn event which notify when the execution has started
Raises
Unknown exceptionExecutionException: If an error occurs during program execution.
def stop(self):

Stop the currently running program.

Raises
Unknown exceptionExecutionException: If an error occurs while stopping the program.
@property
exit_status: Optional[int] =

Get the exit status of the executed program.

@property
is_running: bool =

Check if a program is currently running.

@property
output: str =

Get the standard output of the executed program.

__execution_lock: Lock =

Undocumented

__output: str =

Undocumented

__process: Optional[subprocess.Popen] =

Undocumented