Run a subprocess with callbacks
Project description
Run a command in a subprocess and yield lines from stdout and stderr
Examples:
from subprocessor import Call
for is_error, line in Call('ls foo bar NO_EXIST'):
print(is_error, line)
- Call(cmd, sleep=0, count=None, **kwds)
An iterator for (is_error, line) pairs from a subprocess.
- cmd:
A list or tuple of strings, or a string, to run in a subprocess.
If shell=True, Popen expects a string, so if cmd is a list, it is joined using shlex.
If shell=False, Popen expects a list of strings, so if cmd is a string, it is split using shlex
- sleep:
How long to sleep between checking the process, in seconds
- count:
Maximum number of lines to retrieve at a time from the streams stdout and stderr. If count is empty, retrieve lines until the stream blocks.
- kwds:
Keywords that are passed to subprocess.Popen
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for subprocessor-0.9.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 060b2cfd31112d77dd355e9ee5a6616fea6481d75598da882e12d873050b7b3d |
|
MD5 | 3488e91a580ba2a1495c24f628964bdb |
|
BLAKE2b-256 | a310f02c8ca88dd5e3dbce5964c43d763ad8280b399d7064a9fda3c6bd04d5bd |