From 1a3612fe6d347e458a53d7a9e920a91ea502e6ba Mon Sep 17 00:00:00 2001 From: Jason Chang Date: Tue, 8 Aug 2023 14:12:53 -0700 Subject: Raise RepoExitError in place of sys.exit Bug: b/293344017 Change-Id: Icae4932b00e4068cba502a5ab4a0274fd7854d9d Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/382214 Reviewed-by: Gavin Mak Tested-by: Jason Chang Reviewed-by: Aravind Vasudevan Commit-Queue: Jason Chang --- subcmds/help.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'subcmds/help.py') diff --git a/subcmds/help.py b/subcmds/help.py index 50a48047..593bf676 100644 --- a/subcmds/help.py +++ b/subcmds/help.py @@ -26,6 +26,11 @@ from command import ( ) import gitc_utils from wrapper import Wrapper +from error import RepoExitError + + +class InvalidHelpCommand(RepoExitError): + """Invalid command passed into help.""" class Help(PagedCommand, MirrorSafeCommand): @@ -202,7 +207,7 @@ Displays detailed usage information about a command. print( "repo: '%s' is not a repo command." % name, file=sys.stderr ) - sys.exit(1) + raise InvalidHelpCommand(name) self._PrintCommandHelp(cmd) -- cgit v1.2.3-54-g00ecf