summaryrefslogtreecommitdiffstats
path: root/Lib/gzip.py
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2021-02-26 01:13:17 (GMT)
committerGitHub <noreply@github.com>2021-02-26 01:13:17 (GMT)
commitadea9b86a97794ca75054603497c195d5ba39aa5 (patch)
treedc28422f69f4c7ad72d50909aa683a9d4a711b84 /Lib/gzip.py
parentf82578ace103ec977cec3424b20e0b5f19cf720e (diff)
downloadcpython-adea9b86a97794ca75054603497c195d5ba39aa5.zip
cpython-adea9b86a97794ca75054603497c195d5ba39aa5.tar.gz
cpython-adea9b86a97794ca75054603497c195d5ba39aa5.tar.bz2
bpo-43316: gzip: CLI uses non-zero return code on error. (GH-24647)
Exit code is now 1 instead of 0. A message is printed to stderr instead of stdout. This is the proper behaviour for a tool that can be used in scripts. (cherry picked from commit cc3df6368d4f3f6c9c9b716876c7e7b79c7abf3f) Co-authored-by: Ruben Vorderman <r.h.p.vorderman@lumc.nl>
Diffstat (limited to 'Lib/gzip.py')
-rw-r--r--Lib/gzip.py3
1 files changed, 1 insertions, 2 deletions
diff --git a/Lib/gzip.py b/Lib/gzip.py
index e422773..8002b43 100644
--- a/Lib/gzip.py
+++ b/Lib/gzip.py
@@ -583,8 +583,7 @@ def main():
g = sys.stdout.buffer
else:
if arg[-3:] != ".gz":
- print("filename doesn't end in .gz:", repr(arg))
- continue
+ sys.exit("filename doesn't end in .gz:", repr(arg))
f = open(arg, "rb")
g = builtins.open(arg[:-3], "wb")
else: