##// END OF EJS Templates
hooks: restore io correctly on exception
Jesse Long -
r7416:196b05a5 default
parent child Browse files
Show More
@@ -96,6 +96,7 def hook(ui, repo, name, throw=False, **
96 oldstdout = os.dup(sys.__stdout__.fileno())
96 oldstdout = os.dup(sys.__stdout__.fileno())
97 os.dup2(sys.__stderr__.fileno(), sys.__stdout__.fileno())
97 os.dup2(sys.__stderr__.fileno(), sys.__stdout__.fileno())
98
98
99 try:
99 for hname, cmd in util.sort(ui.configitems('hooks')):
100 for hname, cmd in util.sort(ui.configitems('hooks')):
100 if hname.split('.')[0] != name or not cmd:
101 if hname.split('.')[0] != name or not cmd:
101 continue
102 continue
@@ -106,7 +107,7 def hook(ui, repo, name, throw=False, **
106 args, throw) or r
107 args, throw) or r
107 else:
108 else:
108 r = _exthook(ui, repo, hname, cmd, args, throw) or r
109 r = _exthook(ui, repo, hname, cmd, args, throw) or r
109
110 finally:
110 if _redirect:
111 if _redirect:
111 os.dup2(oldstdout, sys.__stdout__.fileno())
112 os.dup2(oldstdout, sys.__stdout__.fileno())
112 os.close(oldstdout)
113 os.close(oldstdout)
General Comments 0
You need to be logged in to leave comments. Login now