mirror of
ssh://git.janware.com/srv/git/janware/proj/jw-python
synced 2026-01-15 01:52:56 +01:00
Cmds.__run(): Don't exit(0)
WSGI doesn't like sys.exit() being called, so avoid it. Two cases
need to be taken into consideration:
1. No exception thrown by self.args.func()
The variable exit_status is zero, we can check that and _not_
call sys.exit()
2. Exception thrown by self.args.func()
In that case, the exception should be raised, to be caught by
WSGI / ASGI whatever to do what they want with it. The code
calling sys.exit() is never reached. Hence, we need to add
--backtrace to the invocation options.
Signed-off-by: Jan Lindemann <jan@janware.com>
This commit is contained in:
parent
1a267dd2e5
commit
d35a5588cd
1 changed files with 2 additions and 1 deletions
|
|
@ -136,6 +136,7 @@ class Cmds: # export
|
|||
slog(NOTICE, f'Writing profile statistics to {self.args.write_profile}')
|
||||
pr.dump_stats(self.args.write_profile)
|
||||
|
||||
if exit_status:
|
||||
sys.exit(exit_status)
|
||||
|
||||
def __del__(self):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue