dummynet.HostShell
¶
- class dummynet.HostShell(log, sudo, process_monitor)¶
A shell object for running commands
- __init__(log, sudo, process_monitor)¶
Create a new HostShell object
- Parameters:
log – The logger to use
sudo – Whether to run commands with sudo
process_monitor – The monitor is used to track running processes and to stop them when the test is finished.
- run(cmd: str, cwd=None, env=None, timeout=None)¶
Run a synchronous command (blocking) with a timeout.
- Parameters:
cmd – The command to run
cwd – The current working directory i.e. where the command will run
env – The environment variables to set
timeout – Maximum time (in seconds) to wait for the command to complete
- run_async(cmd: str, daemon=False, cwd=None, env=None)¶
Run an asynchronous command (non-blocking).
- Parameters:
cmd – The command to run
cwd – The current working directory i.e. where the command will run