Skip to main content

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)
cmd:

A list or tuple of strings, or a string.

If shell=True, Popen expects a string, so if cmd is a list, it is joined with spaces.

If shell=False, Popen expects a list of strings, so if cmd is a string, it is split using shlex

out:

out is called for each line in the subprocess’s stdout

err:

err is called for each line in the subprocess’s stderr

sleep:

How long to sleep between checking the processes, 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

subprocessor-0.9.0.tar.gz (2.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

subprocessor-0.9.0-py3-none-any.whl (3.7 kB view details)

Uploaded Python 3

File details

Details for the file subprocessor-0.9.0.tar.gz.

File metadata

  • Download URL: subprocessor-0.9.0.tar.gz
  • Upload date:
  • Size: 2.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/45.1.0 requests-toolbelt/0.9.1 tqdm/4.41.1 CPython/3.8.1

File hashes

Hashes for subprocessor-0.9.0.tar.gz
Algorithm Hash digest
SHA256 cbd8531774b63556ea791863066ca767104a58dff2c408c7291eeba7c6adaa93
MD5 62e0e5597a9bb1a53ffa18f3ca86f8dd
BLAKE2b-256 fef31d768ec6b1e2f3b4b77a018dfa2614941fa6d2fefa25364faf2e6d556346

See more details on using hashes here.

File details

Details for the file subprocessor-0.9.0-py3-none-any.whl.

File metadata

  • Download URL: subprocessor-0.9.0-py3-none-any.whl
  • Upload date:
  • Size: 3.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/45.1.0 requests-toolbelt/0.9.1 tqdm/4.41.1 CPython/3.8.1

File hashes

Hashes for subprocessor-0.9.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0d9d7046cea567640a25ffff234e667b9ef9e650c2cac5d0d6433f9dc541c9c1
MD5 0bf3a0b658f362a22171136267ed1de8
BLAKE2b-256 dbe670c81577e3ebeb56664a24a2148389e2f17f540457d513eb5e7f2c2a8244

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page