Run a command and tee its stdout/stderr in real time to your terminal while also capturing them.
Project description
live-tee-and-capture
Run a command and tee its stdout/stderr in real time to your terminal while also capturing them.
- Outputs are relayed byte by byte with no artificial buffering - ideal for real-time logs and progress bars.
- You can enable/disable teeing stdout/stderr independently.
Usage
Example
from live_tee_and_capture import live_tee_and_capture
exit_code, stdout_bytes, stderr_bytes = live_tee_and_capture(
['ls', '-la'],
tee_stdout=True,
tee_stderr=True,
)
print('Exit code:', exit_code)
print('Captured stdout:', stdout_bytes.decode())
print('Captured stderr:', stderr_bytes.decode())
Function Signature
def live_tee_and_capture(
command: Sequence[True],
tee_stdout: bool = True,
tee_stderr: bool = True,
) -> Tuple[int, bytearray, bytearray]:
...
Contributing
Contributions are welcome! Please submit pull requests or open issues on the GitHub repository.
License
This project is licensed under the MIT License.
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file live_tee_and_capture-0.1.0a0.tar.gz.
File metadata
- Download URL: live_tee_and_capture-0.1.0a0.tar.gz
- Upload date:
- Size: 3.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8c2af1fed2521385185698101f6ba0b13212fcc21d5ca852617c7402cc14a0b0
|
|
| MD5 |
af815560a7bc62aa6857b638e20eb518
|
|
| BLAKE2b-256 |
1b342d33a839701dcb718360d931127b80889de2f6992deaa84a2176846b8887
|
File details
Details for the file live_tee_and_capture-0.1.0a0-py2.py3-none-any.whl.
File metadata
- Download URL: live_tee_and_capture-0.1.0a0-py2.py3-none-any.whl
- Upload date:
- Size: 3.6 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7e99d54fcf46feb17d481bdcae438439cef7d7f7ac649e540677115fba6efa73
|
|
| MD5 |
1b6fa5f6db58d194bfb0ec090e6c8882
|
|
| BLAKE2b-256 |
dceb27cbb01ea414431285f12d4b24587a5cec45b8a8fd4995ee3a6fe31012f1
|