bundles / IPython latest / IPython / utils / _process_common / process_handler
function
IPython.utils._process_common:process_handler
Signature
def process_handler ( cmd : Union[str, List[str]] , callback : Callable[[subprocess.Popen[bytes]], _T] , stderr : int = -1 ) → _T | None Summary
Open a command in a shell subprocess and execute a callback.
Extended Summary
This function provides common scaffolding for creating subprocess.Popen() calls. It creates a Popen object and then calls the callback with it.
Parameters
cmd: str or listA command to be executed by the system, using subprocess.Popen. If a string is passed, it will be run in the system shell. If a list is passed, it will be used directly as arguments.
callback: callableA one-argument function that will be called with the Popen object.
stderr: file descriptor number, optionalBy default this is set to
subprocess.PIPE, but you can also pass the valuesubprocess.STDOUTto force the subprocess' stderr to go into the same file descriptor as its stdout. This is useful to read stdout and stderr combined in the order they are generated.
Returns
: The return value of the provided callback is returned.
Aliases
-
IPython.utils._process_common.process_handler