Skip to content

DiamondLightSource/python-procrunner

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ProcRunner

PyPI release Conda Version Build status Build status Documentation Status Supported Python versions Code style: black

Versatile utility function to run external processes

Features

  • runs an external process and waits for it to finish
  • does not deadlock, no matter the process stdout/stderr output behaviour
  • returns the exit code, stdout, stderr (separately, both as bytestrings), as a subprocess.CompletedProcess object
  • process can run in a custom environment, either as a modification of the current environment or in a new environment from scratch
  • stdin can be fed to the process
  • stdout and stderr is printed by default, can be disabled
  • stdout and stderr can be passed to any arbitrary function for live processing (separately, both as unicode strings)
  • optionally enforces a time limit on the process, raising a subprocess.TimeoutExpired exception if it is exceeded.

Credits

This package was created with Cookiecutter and the audreyr/cookiecutter-pypackage project template.