Skip to content

Instantly share code, notes, and snippets.

@ob
Created September 12, 2016 17:00
Show Gist options
  • Save ob/2fb860d5aea6a75c2ef3863c7b4b255d to your computer and use it in GitHub Desktop.
Save ob/2fb860d5aea6a75c2ef3863c7b4b255d to your computer and use it in GitHub Desktop.
diff --git a/click/core.py b/click/core.py
index 1fcf415..ec7c569 100644
--- a/click/core.py
+++ b/click/core.py
@@ -694,13 +694,7 @@ class BaseCommand(object):
try:
try:
with self.make_context(prog_name, args, **extra) as ctx:
- try:
- rv = self.invoke(ctx)
- except IOError as e:
- if e.errno == errno.EPIPE:
- sys.exit(errno.EPIPE)
- else:
- raise
+ rv = self.invoke(ctx)
if not standalone_mode:
return rv
ctx.exit()
@@ -712,6 +706,11 @@ class BaseCommand(object):
raise
e.show()
sys.exit(e.exit_code)
+ except IOError as e:
+ if e.errno == errno.EPIPE:
+ sys.exit(errno.EPIPE)
+ else:
+ raise
except Abort:
if not standalone_mode:
raise
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment