Open mattculler opened 1 month ago
There's another two instances that return 128 + signal.SIGINT
:
Maybe a definition like this somewhere can be used to refer to 128 + signal.SIGINT
with a proper name?
EX_KEYBOARD_INTERRUPT = 128 + signal.SIGINT
Not sure if there's a better "name" for 128 + signal.SIGINT
, A quick google search reveals this and in turn this.
Oh nice - I didn't know about those constants. We can replace some of these cases, but not the specific one mentioned without adding our own set or using a library.
I've created #387 to handle the simple cases, but I'll have to think about the 128+blah ones. The place where @thp-canonical points out is indeed where I got that value.
What needs to get done
In
application.py
(as well aserrors.py
andservices/remotebuild.py
) there are hardcoded constants that refer tosysexits.h
. These constants are already defined in the python standard library underos
: https://docs.python.org/3/library/os.html#os.EX_OKMore pedantic, less important:
PartsError
andProviderError
both exit 1 - whether these are changed to something more distinctive or not, these should be defined publically, so the values can be used in unit tests.CraftError
exits an overrideable value that it defines internally as defaulting to 1, this can also be exposed for tests.Why it needs to get done
Using predefined values is better practice than using magic numbers with explanatory comments.