One function

get_rc_exc in amoffat/sh

The author described this change as Properly raise ErrorReturnCode_0 on exit code 0. It counts as a record because the check below fails on the code as it stood at 4b90c9333 and passes on eb9d051f1, with nothing else changed between the two runs.

Projectamoffat/sh
Fix saved2020-10-21
Sharing licenceMIT · LICENSE.txt
Change size+1 1

What the code was meant to do, written into the code itself as a docstring

takes a exit code or negative signal number and produces an exception that corresponds to that return code. positive return codes yield ErrorReturnCode exception, negative return codes yield SignalException we also cache the generated exception so that only one signal of that type exists, preserving identity

The change

1111 except KeyError:
1212 pass
1313
14- if rc > 0:
14+ if rc >= 0:
1515 name = "ErrorReturnCode_%d" % rc
1616 base = ErrorReturnCode
1717 else:

The check that tells the two apart

failpass·test.py::FunctionalTests::test_ok_code_exception

Check file test.py, taken without changes from the fix and copied onto the older code, so the exact same check runs against both versions.

Origin and history

The code before it4b90c933397b284cd1a61501a7fcd605d364a085
Broken version dated2020-09-04
Modulesh
Units changedget_rc_exc
Fingerprint2586fb5b9a3f5706
Checked2026-08-18 by goldset/0.1

Every field above is generated by our program. None of it is written by hand.

Other bugs found in amoffat/sh