subprocess-tee
subprocess-tee copied to clipboard
A subprocess.run drop-in replacement that supports a tee mode, being able to display output in real time while still capturing it. No dependencies needed
updates: - [github.com/psf/black: 24.2.0 → 24.4.2](https://github.com/psf/black/compare/24.2.0...24.4.2) - [github.com/pre-commit/pre-commit-hooks.git: v4.5.0 → v4.6.0](https://github.com/pre-commit/pre-commit-hooks.git/compare/v4.5.0...v4.6.0) - [github.com/pre-commit/mirrors-mypy: v1.8.0 → v1.10.0](https://github.com/pre-commit/mirrors-mypy/compare/v1.8.0...v1.10.0)
I thought subprocess-tee would fit in nicely for the following example ```py from subprocess_tee import run o = run("ssh remotehost -t sudo cat /super/secret/file")) # now trim of the password...
When passing a list of arguments, subprocess-tee converts that to a single string with `shlex.join`. If one of the arguments contains a backslash, it is enclosed in single-quotes (`'`). This...
Single-argument commands work, e.g. ```py from subprocess_tee import run run(["git"]) ``` With multiple arguments, an error is raised: ``` $ python -c "from subprocess_tee import run; run(['git status'])" Traceback (most...
Setting `stderr=subprocess.STDOUT` is currently ignored.
```py print(subprocess_tee.run(["cat", "/dev/null"]).stdout) # Prints "" print(subprocess_tee.run(["cat", "/dev/null"], check=True).stdout) # Prints "None" ```
When there is no space in the command ```py subprocess.run(["a"]) ``` Will not use the shell, but with: ```py subprocess_tee.run(["a"]) ``` will be run as a shell. I think it...