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 hashes)