⛏ 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
Release history Release notifications | RSS feed
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.4.1.tar.gz
(4.4 kB
view details)
Built Distribution
sproc-2.4.1-py3-none-any.whl
(5.1 kB
view details)
File details
Details for the file sproc-2.4.1.tar.gz
.
File metadata
- Download URL: sproc-2.4.1.tar.gz
- Upload date:
- Size: 4.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.7.1 CPython/3.10.11 Darwin/21.6.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 |
9753942c284fc1927623f58e3ecf1b0286c854d09e6f331f490e5bb309058ad0
|
|
MD5 |
773c02a62a6237098766a0a9fdc719d5
|
|
BLAKE2b-256 |
5e9099b4aa68228420860e173d3ef3a9cb18fd0fcfefb2d7a10cee1fa5825a49
|
File details
Details for the file sproc-2.4.1-py3-none-any.whl
.
File metadata
- Download URL: sproc-2.4.1-py3-none-any.whl
- Upload date:
- Size: 5.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.7.1 CPython/3.10.11 Darwin/21.6.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 |
bced068f51ee206c9962a09d0d789d57330ed80bbc032f17c7aae8e1cfdb7e29
|
|
MD5 |
988c92c72caedb94a95288641a0f2cb7
|
|
BLAKE2b-256 |
2e813e85035016138e6ee0892f561a5b4f86a2cfaf3ba89c8efc0326151cb267
|