comparison mercurial/commands.py @ 832:b65773f7db41

Handle broken pipe on pressing Ctrl-C with e.g. 'hg log|grep something'.
author Thomas Arendsen Hein <thomas@intevation.de>
date Thu, 04 Aug 2005 18:06:49 +0100
parents eef752151556
children 1fe3b14c7044
comparison
equal deleted inserted replaced
831:232d0616a80a 832:b65773f7db41
1398 except hg.RepoError, inst: 1398 except hg.RepoError, inst:
1399 u.warn("abort: ", inst, "!\n") 1399 u.warn("abort: ", inst, "!\n")
1400 except SignalInterrupt: 1400 except SignalInterrupt:
1401 u.warn("killed!\n") 1401 u.warn("killed!\n")
1402 except KeyboardInterrupt: 1402 except KeyboardInterrupt:
1403 u.warn("interrupted!\n") 1403 try:
1404 u.warn("interrupted!\n")
1405 except IOError, inst:
1406 if inst.errno == errno.EPIPE:
1407 if u.debugflag:
1408 u.warn("\nbroken pipe\n")
1409 else:
1410 raise
1404 except IOError, inst: 1411 except IOError, inst:
1405 if hasattr(inst, "code"): 1412 if hasattr(inst, "code"):
1406 u.warn("abort: %s\n" % inst) 1413 u.warn("abort: %s\n" % inst)
1407 elif hasattr(inst, "reason"): 1414 elif hasattr(inst, "reason"):
1408 u.warn("abort: error: %s\n" % inst.reason[1]) 1415 u.warn("abort: error: %s\n" % inst.reason[1])