simple python wrapper around FreeBSD sysexits
Project description
A simple python wrapper around the FreeBSD “preferable exit codes for programs”.
It is useful for getting informative error messages from subprocesses which use FreeBSD-recommended exit codes (linked above).
Usage
Either select an exception manually using the EXCEPTIONS dictionary, or call raise_for_returncode with the completed process.
import subprocess
import sysexits
print(sysexits.EX_PROTOCOL)
# 76
process = subprocess.run("exit 76", shell=True)
print(sysexits.EXCEPTIONS[process.returncode])
# <class 'sysexits.ProtocolError'>
sysexits.raise_for_returncode(process)
# Traceback (most recent call last):
# ...
# sysexits.ProtocolError
License
Copyright (c) 2022 Christopher McDonald
Distributed under the terms of 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
sysexits-0.5.0.tar.gz
(6.5 kB
view details)
Built Distribution
File details
Details for the file sysexits-0.5.0.tar.gz
.
File metadata
- Download URL: sysexits-0.5.0.tar.gz
- Upload date:
- Size: 6.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.0 CPython/3.9.13
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e9fc1fdab013b146dcd507d2df55cd7a005a3bf4c97b787160432c0d66a02ea5 |
|
MD5 | d0c0bda4762b9ac70a64c81b2ab2e804 |
|
BLAKE2b-256 | 1128a47a662771e306a79607081ce6900d96462af4b953760a93f3fb5a73095d |
File details
Details for the file sysexits-0.5.0-py3-none-any.whl
.
File metadata
- Download URL: sysexits-0.5.0-py3-none-any.whl
- Upload date:
- Size: 4.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.0 CPython/3.9.13
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 16e7ab45d1c558ee9d7177c387b4fedff4302470d07b7c49909171618d6dae46 |
|
MD5 | d0569b67b6e082d3ac46c0192f72fa63 |
|
BLAKE2b-256 | 4a167b9d246fca6fd26e827a6a2f9e2a157dfa3bb0e5d612787bccf2e5a03875 |