rad  3.0.0
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Classes | Functions | Variables
etr.tools.subprocess Namespace Reference

Classes

class  KillOrphansContextManager
 Use instead of popen to perform cleanup of orphan subprocesses. More...
 
class  SignalContextManager
 Provides a context manager to be able to captue signals and forward them to a subprocess within a context manager scope. More...
 

Functions

def cmd_and_log (List[str] command, *Optional[bool] kill_orphans=None, Optional[Callable[[str], None]] line_handler=None, Optional[bool] script_file=None, **kwargs)
 Runs command and logs to line_handler. More...
 

Variables

string TEMPLATE
 

Function Documentation

◆ cmd_and_log()

def etr.tools.subprocess.cmd_and_log ( List[str]  command,
*Optional[bool]   kill_orphans = None,
Optional[Callable[[str], None]]   line_handler = None,
Optional[bool]   script_file = None,
**  kwargs 
)

Runs command and logs to line_handler.

It can also generate a script file that re-creates the execution environment which can be useful for debugging outside etr.

Parameters
commandCommand to execute.
kill_orphansWhether to kill orphaned processes or not. Default is True.
line_handlerCallback invoked for each line of output of command
script_fileWhether or not to generate a script file that reproduce the command invocation.
Returns
None

Variable Documentation

◆ TEMPLATE

string etr.tools.subprocess.TEMPLATE