Util functions for calling external commands
pbcommand.engine.
run_cmd
(cmd, stdout_fh, stderr_fh, shell=True, time_out=None, env=None, executable='/bin/bash')[source]¶Run external command
Param: cmd: External command Parameters: time_out (None | int) – Timeout in seconds. Returns: ExtCmdResult This could all be bundled into a context manager
- with RunCommand(‘/path/stdout’, ‘/path/to/stderr’) as r:
- r.exe(“echo ‘exe1’) r.exe(“echo ‘exe2’) result = r.get_result() # close the file handles