Mercurial > public > mercurial-scm > hg
comparison mercurial/dispatch.py @ 26350:ccab61d84ea7
dispatch: stop warning about EPIPE in --debug mode
It seems silly for "hg --debug manifest | less" to print a scary
message after the user hits "q" in less. hg should just exit silently
instead, since EPIPE on stdout is a perfectly reasonable result.
author | Daniel Colascione <dancol@fb.com> |
---|---|
date | Thu, 24 Sep 2015 10:15:37 +0300 |
parents | bf2bfc6f45fb |
children | 6e9c2aab9925 |
comparison
equal
deleted
inserted
replaced
26349:92409f8dff5d | 26350:ccab61d84ea7 |
---|---|
290 # SSLError of Python 2.7.9 contains a unicode | 290 # SSLError of Python 2.7.9 contains a unicode |
291 reason = reason.encode(encoding.encoding, 'replace') | 291 reason = reason.encode(encoding.encoding, 'replace') |
292 ui.warn(_("abort: error: %s\n") % reason) | 292 ui.warn(_("abort: error: %s\n") % reason) |
293 elif (util.safehasattr(inst, "args") | 293 elif (util.safehasattr(inst, "args") |
294 and inst.args and inst.args[0] == errno.EPIPE): | 294 and inst.args and inst.args[0] == errno.EPIPE): |
295 if ui.debugflag: | 295 pass |
296 ui.warn(_("broken pipe\n")) | |
297 elif getattr(inst, "strerror", None): | 296 elif getattr(inst, "strerror", None): |
298 if getattr(inst, "filename", None): | 297 if getattr(inst, "filename", None): |
299 ui.warn(_("abort: %s: %s\n") % (inst.strerror, inst.filename)) | 298 ui.warn(_("abort: %s: %s\n") % (inst.strerror, inst.filename)) |
300 else: | 299 else: |
301 ui.warn(_("abort: %s\n") % inst.strerror) | 300 ui.warn(_("abort: %s\n") % inst.strerror) |
308 ui.warn(_("abort: %s\n") % inst.strerror) | 307 ui.warn(_("abort: %s\n") % inst.strerror) |
309 except KeyboardInterrupt: | 308 except KeyboardInterrupt: |
310 try: | 309 try: |
311 ui.warn(_("interrupted!\n")) | 310 ui.warn(_("interrupted!\n")) |
312 except IOError as inst: | 311 except IOError as inst: |
313 if inst.errno == errno.EPIPE: | 312 if inst.errno != errno.EPIPE: |
314 if ui.debugflag: | |
315 ui.warn(_("\nbroken pipe\n")) | |
316 else: | |
317 raise | 313 raise |
318 except MemoryError: | 314 except MemoryError: |
319 ui.warn(_("abort: out of memory\n")) | 315 ui.warn(_("abort: out of memory\n")) |
320 except SystemExit as inst: | 316 except SystemExit as inst: |
321 # Commands shouldn't sys.exit directly, but give a return code. | 317 # Commands shouldn't sys.exit directly, but give a return code. |