bpo-39828: Fix json.tool to catch BrokenPipeError (GH-18779)

diff --git a/Lib/json/tool.py b/Lib/json/tool.py
index 6d7d9a0..5dee0a7 100644
--- a/Lib/json/tool.py
+++ b/Lib/json/tool.py
@@ -72,4 +72,7 @@
 
 
 if __name__ == '__main__':
-    main()
+    try:
+        main()
+    except BrokenPipeError as exc:
+        sys.exit(exc.errno)