File tree Expand file tree Collapse file tree 1 file changed +12
-4
lines changed
Expand file tree Collapse file tree 1 file changed +12
-4
lines changed Original file line number Diff line number Diff line change @@ -251,8 +251,12 @@ def arg_decorator(func: Callable):
251251 @functools .wraps (func )
252252 def cmd_wrapper (instance , cmdline ):
253253 lexed_arglist = parse_quoted_string (cmdline )
254- args , unknown = argparser .parse_known_args (lexed_arglist )
255- return func (instance , args , unknown )
254+ try :
255+ args , unknown = argparser .parse_known_args (lexed_arglist )
256+ except SystemExit :
257+ return
258+ else :
259+ return func (instance , args , unknown )
256260
257261 # argparser defaults the program name to sys.argv[0]
258262 # we want it to be the name of our command
@@ -288,8 +292,12 @@ def arg_decorator(func: Callable):
288292 @functools .wraps (func )
289293 def cmd_wrapper (instance , cmdline ):
290294 lexed_arglist = parse_quoted_string (cmdline )
291- args = argparser .parse_args (lexed_arglist )
292- return func (instance , args )
295+ try :
296+ args = argparser .parse_args (lexed_arglist )
297+ except SystemExit :
298+ return
299+ else :
300+ return func (instance , args )
293301
294302 # argparser defaults the program name to sys.argv[0]
295303 # we want it to be the name of our command
You can’t perform that action at this time.
0 commit comments