osmith submitted this change.
src/grd: use sys.exit
The exit function is a constant from the site module, which "should not
be used in programs". Replace it with sys.exit()
Related: https://docs.python.org/3/library/constants.html#constants-added-by-the-site-module
Change-Id: I95db013e36242d5126ce07b8a392e6dc0a0ecfdd
---
M src/grd
1 file changed, 7 insertions(+), 6 deletions(-)
diff --git a/src/grd b/src/grd
index 64de140..d86225d 100755
--- a/src/grd
+++ b/src/grd
@@ -8,8 +8,9 @@
import json
import os
import subprocess
-import urllib.request
+import sys
import urllib.parse
+import urllib.request
def get_topdir():
@@ -22,14 +23,14 @@
).stdout.rstrip()
except subprocess.CalledProcessError:
print("ERROR: not running inside a git repository")
- exit(1)
+ sys.exit(1)
def get_config_path():
ret = f"{get_topdir()}/.gitreview"
if not os.path.exists(ret):
print(f"ERROR: config not found: {ret}")
- exit(1)
+ sys.exit(1)
return ret
@@ -72,7 +73,7 @@
try:
return subprocess.run(cmd, check=True)
except subprocess.CalledProcessError:
- exit(1)
+ sys.exit(1)
def git_cherry_pick_fetch_head():
@@ -82,7 +83,7 @@
try:
return subprocess.run(cmd, check=True)
except subprocess.CalledProcessError:
- exit(1)
+ sys.exit(1)
def git_checkout_fetch_head(patch_id, rev):
@@ -92,7 +93,7 @@
try:
return subprocess.run(cmd, check=True)
except subprocess.CalledProcessError:
- exit(1)
+ sys.exit(1)
desc = "git review download: fetch and checkout a patch from gerrit"
To view, visit change 42901. To unsubscribe, or for help writing mail filters, visit settings.