summaryrefslogtreecommitdiffstats
path: root/Lib/json
diff options
context:
space:
mode:
authorDong-hee Na <donghee.na92@gmail.com>2020-03-10 08:14:08 (GMT)
committerGitHub <noreply@github.com>2020-03-10 08:14:08 (GMT)
commitcaec8a0dfbed04bdb8567782fdff7537529d2232 (patch)
treed7d0b1526d12604386cce861c1d2932ab70a36be /Lib/json
parentcadfe52a006abb46ea0948c6ae2e006064b4a091 (diff)
downloadcpython-caec8a0dfbed04bdb8567782fdff7537529d2232.zip
cpython-caec8a0dfbed04bdb8567782fdff7537529d2232.tar.gz
cpython-caec8a0dfbed04bdb8567782fdff7537529d2232.tar.bz2
[3.8] bpo-39828: Fix json.tool to catch BrokenPipeError (GH-18779). (GH-18894)
(cherry picked from commit 700cb587303461d5a96456c56902cfdd8ad50e2d) Co-authored-by: Dong-hee Na <donghee.na92@gmail.com> Automerge-Triggered-By: @vstinner
Diffstat (limited to 'Lib/json')
-rw-r--r--Lib/json/tool.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/Lib/json/tool.py b/Lib/json/tool.py
index 8db9ea4..c42138a 100644
--- a/Lib/json/tool.py
+++ b/Lib/json/tool.py
@@ -52,4 +52,7 @@ def main():
if __name__ == '__main__':
- main()
+ try:
+ main()
+ except BrokenPipeError as exc:
+ sys.exit(exc.errno)