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.6.0.tar.gz (30.8 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.6.0-py3-none-any.whl (5.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: sproc-2.6.0.tar.gz
  • Upload date:
  • Size: 30.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.12 {"installer":{"name":"uv","version":"0.10.12","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.6.0.tar.gz
Algorithm Hash digest
SHA256 3ef77cc71822eab6c5f968abefcd50acaac0e431f57224923214231df6814cb0
MD5 17c018385866f61a4212559a04861c7f
BLAKE2b-256 8b87c8906f24dfd63fdd2b097f9d801427d257e562d10da518f71b5ef77960f7

See more details on using hashes here.

File details

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

File metadata

  • Download URL: sproc-2.6.0-py3-none-any.whl
  • Upload date:
  • Size: 5.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.12 {"installer":{"name":"uv","version":"0.10.12","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.6.0-py3-none-any.whl
Algorithm Hash digest
SHA256 42f72834142db1d0270f6c5f5405f2225708989643d88ada2efd5714cab54fec
MD5 c16f4ee472738ec02e68974c9d884849
BLAKE2b-256 4409460b6b8a9e53114a91f5d09dbb36250ef7b44e8ac748415a75ec624ece35

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