equal
deleted
inserted
replaced
132 def hook(ui, repo, name, throw=False, **args): |
132 def hook(ui, repo, name, throw=False, **args): |
133 r = False |
133 r = False |
134 |
134 |
135 oldstdout = -1 |
135 oldstdout = -1 |
136 if _redirect: |
136 if _redirect: |
137 stdoutno = sys.__stdout__.fileno() |
137 try: |
138 stderrno = sys.__stderr__.fileno() |
138 stdoutno = sys.__stdout__.fileno() |
139 # temporarily redirect stdout to stderr, if possible |
139 stderrno = sys.__stderr__.fileno() |
140 if stdoutno >= 0 and stderrno >= 0: |
140 # temporarily redirect stdout to stderr, if possible |
141 oldstdout = os.dup(stdoutno) |
141 if stdoutno >= 0 and stderrno >= 0: |
142 os.dup2(stderrno, stdoutno) |
142 oldstdout = os.dup(stdoutno) |
|
143 os.dup2(stderrno, stdoutno) |
|
144 except AttributeError: |
|
145 # __stdout/err__ doesn't have fileno(), it's not a real file |
|
146 pass |
143 |
147 |
144 try: |
148 try: |
145 for hname, cmd in ui.configitems('hooks'): |
149 for hname, cmd in ui.configitems('hooks'): |
146 if hname.split('.')[0] != name or not cmd: |
150 if hname.split('.')[0] != name or not cmd: |
147 continue |
151 continue |