Skip to main content

⛏ Subprocesseses for subhumanses ⛏

Project description

⛏️sproc: subprocesseses for subhumanses ⛏

Run a command in a subprocess and yield lines of text from stdout and stderr independently.

Useful for handling long-running proceesses that write to both stdout and stderr.

Simple Example

import sproc

CMD = 'my-unix-command "My Cool File.txt" No-file.txt'

for ok, line in sproc.Sub(CMD) as sp:
    if ok:
         print(' ', line)
    else:
         print('!', line)

if sp.returncode:
    print('Error code', sp.returncode)

# Return two lists of text lines and a returncode
out_lines, err_lines, returncode = sproc.run(CMD)

# Call callback functions with lines of text read from stdout and stderr
returncode = sproc.call(CMD, save_results, print_errors)

# Log stdout and stderr, with prefixes
returncode = sproc.log(CMD)

API Documentation

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

sproc-2.5.0.tar.gz (3.6 kB view details)

Uploaded Source

Built Distribution

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

sproc-2.5.0-py3-none-any.whl (4.4 kB view details)

Uploaded Python 3

File details

Details for the file sproc-2.5.0.tar.gz.

File metadata

  • Download URL: sproc-2.5.0.tar.gz
  • Upload date:
  • Size: 3.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.28 {"installer":{"name":"uv","version":"0.9.28","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for sproc-2.5.0.tar.gz
Algorithm Hash digest
SHA256 3318224748028bbef39da2ccb414870252124d5602686d23c0a33b99b4b0fd88
MD5 477d0e11f17557e5123e5aa2adcf6cf4
BLAKE2b-256 6238970266ceafe9b9c2fdb0ed5f288b26b70411ee306871234d11578433a699

See more details on using hashes here.

File details

Details for the file sproc-2.5.0-py3-none-any.whl.

File metadata

  • Download URL: sproc-2.5.0-py3-none-any.whl
  • Upload date:
  • Size: 4.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.28 {"installer":{"name":"uv","version":"0.9.28","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for sproc-2.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2e3186cb8e07c1a56d392933aa619033ebfb6f2b155e0a5747ad69f5197a6522
MD5 1c4729f7d3b49362de22f609de421833
BLAKE2b-256 53905d2ae814acc988fbe0edcd1bb8cf1b0529ecfeabaa68a09ea1961fc708cf

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