From b2a7fe166c95ef5d5f5b6af76303cc8d456ac816 Mon Sep 17 00:00:00 2001 From: Amitay Isaacs Date: Fri, 9 Sep 2011 13:22:27 +1000 Subject: [PATCH] samba-tool: Correctly handle sys.exit() called from subcommand Catch SystemExit exception if any subcommand calls sys.exit() and return with failure (-1). Signed-off-by: Andrew Bartlett --- source4/scripting/bin/samba-tool | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/source4/scripting/bin/samba-tool b/source4/scripting/bin/samba-tool index 2e920410768..c1918651521 100755 --- a/source4/scripting/bin/samba-tool +++ b/source4/scripting/bin/samba-tool @@ -77,6 +77,8 @@ if __name__ == '__main__': try: retval = cmd._run("samba-tool", subcommand, *args) - sys.exit(retval) + except SystemExit, e: + retval = -1 except Exception, e: cmd.show_command_error(e) + sys.exit(retval) -- 2.34.1