Skip to main content

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

live_tee_and_capture-0.1.0a0.tar.gz (3.3 kB view details)

Uploaded Source

Built Distribution

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

live_tee_and_capture-0.1.0a0-py2.py3-none-any.whl (3.6 kB view details)

Uploaded Python 2Python 3

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

Hashes for live_tee_and_capture-0.1.0a0.tar.gz
Algorithm Hash digest
SHA256 8c2af1fed2521385185698101f6ba0b13212fcc21d5ca852617c7402cc14a0b0
MD5 af815560a7bc62aa6857b638e20eb518
BLAKE2b-256 1b342d33a839701dcb718360d931127b80889de2f6992deaa84a2176846b8887

See more details on using hashes here.

File details

Details for the file live_tee_and_capture-0.1.0a0-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for live_tee_and_capture-0.1.0a0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 7e99d54fcf46feb17d481bdcae438439cef7d7f7ac649e540677115fba6efa73
MD5 1b6fa5f6db58d194bfb0ec090e6c8882
BLAKE2b-256 dceb27cbb01ea414431285f12d4b24587a5cec45b8a8fd4995ee3a6fe31012f1

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