jw.pkg.lib.App.__run(): Use return value as exit status

If a Cmd-classes's _run() method returns an integer between 0 and
255, use that as the program's exit status.

Signed-off-by: Jan Lindemann <jan@janware.com>
This commit is contained in:
Jan Lindemann 2026-03-03 07:14:47 +01:00
commit 7fcb031795

View file

@ -116,6 +116,9 @@ class App: # export
try: try:
ret = await self._run(self.__args) ret = await self._run(self.__args)
if isinstance(ret, int) and ret >= 0 and ret <= 0xFF:
exit_status = ret
except Exception as e: except Exception as e:
log(ERR, repr(e) if self.__back_trace else str(e)) log(ERR, repr(e) if self.__back_trace else str(e))
exit_status = 1 exit_status = 1