Replace 'sys.exit()' and 'exit()' instructions with 'SystemExit()' equivalents
- `SystemExit` doesn't require importing the `sys` module - `exit()` depends on the `site` module (for this reason its usage is discouraged in production code) Signed-off-by: JoeLametta <JoeLametta@users.noreply.github.com>
This commit is contained in:
@@ -3,7 +3,6 @@
|
||||
|
||||
import argparse
|
||||
import os
|
||||
import sys
|
||||
|
||||
from whipper.common import config, drive
|
||||
|
||||
@@ -109,11 +108,11 @@ class BaseCommand:
|
||||
if hasattr(self, 'subcommands'):
|
||||
if not self.options.remainder:
|
||||
self.parser.print_help()
|
||||
sys.exit(0)
|
||||
raise SystemExit()
|
||||
if not self.options.remainder[0] in self.subcommands:
|
||||
logger.critical("incorrect subcommand: %s",
|
||||
self.options.remainder[0])
|
||||
sys.exit(1)
|
||||
raise SystemExit(1)
|
||||
self.cmd = self.subcommands[self.options.remainder[0]](
|
||||
self.options.remainder[1:],
|
||||
prog_name + " " + self.options.remainder[0],
|
||||
|
||||
Reference in New Issue
Block a user