Exec-cmds-defer-errors
Small Python script that executes given commands and defers errors.
The standalone script is called exec_cmds_defer_errors.py and can be found
here. The license is included in the file.
Here it is used to run three commands:
uv run --script exec_cmds_defer_errors.py \
'whoami | grep goatse' \
'echo "hello world"' \
'make love' \
'sleep 1.5'
Note that in the example the script is executed with uv run, a subcommand of
uv, which is a package manager for Python. This is
because the script contains
inline script metadata
specifying required dependencies. The script also contains a shebang, so it can
be executed directly.
The output will look like this (but colored):
Executing command 1...
whoami | grep goatse
Executed command 1 failed with exit code 1. Took 0.00 seconds.
Executing command 2...
echo "hello world"
hello world
Executed command 2 successfully. Took 0.00 seconds.
Executing command 3...
make love
make: *** No rule to make target 'love'. Stop.
Executed command 3 failed with exit code 2. Took 0.00 seconds.
Executing command 4...
sleep 1.5
Executed command 4 successfully. Took 1.50 seconds.
2 out of 4 command(s) failed.
Command 1 failed with exit code 1: whoami | grep goatse
Command 3 failed with exit code 2: make love
Shell completion
This program uses Click for the CLI. Click provides automatically generated shell completion for Bash, Fish, and Zsh. Check out the official documentation here.
Project status
The project is maintained by me, Tim, and I am interested in keeping it alive as I am actively using it.
Versioning
The project follows Semantic Versioning.
Contributing
Contributions are welcome. Please refer to CONTRIBUTE.md.
Licensing
This work is licensed under the
ISC license. See
LICENSE for the license text.
The license is also included in the script
exec_cmds_defer_errors.py
itself.
Template
This project is based on the following Copier template: https://github.com/trallnag/copier-template-python-script.
Release files for exec-cmds-defer-errors 3.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| exec_cmds_defer_errors-3.0.0.tar.gz | 35.5 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| exec_cmds_defer_errors-3.0.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 41.3 kB
Release files / exec_cmds_defer_errors-3.0.0.tar.gz
| Download URL | exec_cmds_defer_errors-3.0.0.tar.gz |
|---|---|
| Size | 35.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
562d541deafae5f79e88383c54d1ad5f3a57f38ff89212a66adba503420b5cb2
|
|
BLAKE2b-256 checksum How to use checksums |
ec1ccece42449270b85af9dca62b5764325c40b507c545f182970f136408a643
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.13
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jul 10, 2026.
Transparency logRelease files / exec_cmds_defer_errors-3.0.0-py3-none-any.whl
| Download URL | exec_cmds_defer_errors-3.0.0-py3-none-any.whl |
|---|---|
| Size | 5.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
1eb7aeb188ddb47045b408c448928e355453ea28c8305ec205a5da26a2137386
|
|
BLAKE2b-256 checksum How to use checksums |
ce2a10991bcdbb667b0e24fe882cc8e231f59a929066764aec9bbfed5b0dbe25
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.13
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jul 10, 2026.
Transparency log