Skip to main content

A drop-in replacement for `subprocess.run` that captures stdout and stderr while also displaying output live in the console.

Project description

capture-run

PyPI - Python Version PyPI - Version PyPI - Downloads PyPI - License GitHub - Pytest GitHub - Release codecov pre-commit


A drop-in replacement for subprocess.run that captures stdout and stderr while also displaying output live in the console.

Installation

pip install capture-run

Usage

>>> from capture import run

>>> run("echo $ bytes")
$ bytes
CompletedProcess(args='echo $ bytes', returncode=0, stdout=b'$ bytes\r\n', stderr=b'')

>>> run("echo $ text", text=True)
$ text
CompletedProcess(args='echo $ text', returncode=0, stdout='$ text\n', stderr='')

>>> run("echo $ captured", capture_output=True, encoding="utf-8")
CompletedProcess(args='echo $ captured', returncode=0, stdout='$ captured\n', stderr='')

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

capture_run-0.1.0.tar.gz (3.8 kB view details)

Uploaded Source

Built Distribution

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

capture_run-0.1.0-py3-none-any.whl (4.1 kB view details)

Uploaded Python 3

File details

Details for the file capture_run-0.1.0.tar.gz.

File metadata

  • Download URL: capture_run-0.1.0.tar.gz
  • Upload date:
  • Size: 3.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.5 CPython/3.13.3 Linux/6.11.0-1013-azure

File hashes

Hashes for capture_run-0.1.0.tar.gz
Algorithm Hash digest
SHA256 5d13469d189a84ece1b79074ac4d45e6cdabf1806a91fe7ef2f6362903460758
MD5 b02fe3818c6c4301807f8dfc215e0dc8
BLAKE2b-256 ac9751b8d356beb5ed60a526f8ff8c04b8688a3ab2b17788bfffda22c2c183b1

See more details on using hashes here.

File details

Details for the file capture_run-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: capture_run-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 4.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.5 CPython/3.13.3 Linux/6.11.0-1013-azure

File hashes

Hashes for capture_run-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 39107ab4a1f1390e74f0af53db5e747f74cdec1c1d158accf485d012b19abc4a
MD5 01b5088e68983d899121f6975250ef4c
BLAKE2b-256 04172fb7315fc9479ff6991f3f431ff977e705834bc4b06b9758b391b1146c94

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