equal
deleted
inserted
replaced
250 status = _rundispatch(req) |
250 status = _rundispatch(req) |
251 except error.StdioError as e: |
251 except error.StdioError as e: |
252 err = e |
252 err = e |
253 status = -1 |
253 status = -1 |
254 |
254 |
255 ret = _flushstdio(req.ui, err) |
255 # Somehow we have to catcht he exception here; catching it inside |
256 if ret and not status: |
256 # _flushstdio() doesn't work. |
257 status = ret |
257 try: |
|
258 ret = _flushstdio(req.ui, err) |
|
259 if ret and not status: |
|
260 status = ret |
|
261 except BaseException: |
|
262 pass |
258 return status |
263 return status |
259 |
264 |
260 |
265 |
261 def _rundispatch(req): |
266 def _rundispatch(req): |
262 with tracing.log('dispatch._rundispatch'): |
267 with tracing.log('dispatch._rundispatch'): |
312 if inst.errno != errno.EPIPE: |
317 if inst.errno != errno.EPIPE: |
313 raise |
318 raise |
314 ret = -1 |
319 ret = -1 |
315 finally: |
320 finally: |
316 duration = util.timer() - starttime |
321 duration = util.timer() - starttime |
317 req.ui.flush() # record blocked times |
322 try: |
|
323 req.ui.flush() # record blocked times |
|
324 except BaseException: |
|
325 pass |
318 if req.ui.logblockedtimes: |
326 if req.ui.logblockedtimes: |
319 req.ui._blockedtimes[b'command_duration'] = duration * 1000 |
327 req.ui._blockedtimes[b'command_duration'] = duration * 1000 |
320 req.ui.log( |
328 req.ui.log( |
321 b'uiblocked', |
329 b'uiblocked', |
322 b'ui blocked ms\n', |
330 b'ui blocked ms\n', |
336 try: |
344 try: |
337 req._runexithandlers() |
345 req._runexithandlers() |
338 except: # exiting, so no re-raises |
346 except: # exiting, so no re-raises |
339 ret = ret or -1 |
347 ret = ret or -1 |
340 # do flush again since ui.log() and exit handlers may write to ui |
348 # do flush again since ui.log() and exit handlers may write to ui |
341 req.ui.flush() |
349 try: |
|
350 req.ui.flush() |
|
351 except BaseException: |
|
352 pass |
342 return ret |
353 return ret |
343 |
354 |
344 |
355 |
345 def _runcatch(req): |
356 def _runcatch(req): |
346 with tracing.log('dispatch._runcatch'): |
357 with tracing.log('dispatch._runcatch'): |
457 with demandimport.deactivated(): |
468 with demandimport.deactivated(): |
458 debugtrace[debugger]() |
469 debugtrace[debugger]() |
459 try: |
470 try: |
460 return _dispatch(req) |
471 return _dispatch(req) |
461 finally: |
472 finally: |
462 ui.flush() |
473 try: |
|
474 ui.flush() # record blocked times |
|
475 except BaseException: |
|
476 pass |
463 except: # re-raises |
477 except: # re-raises |
464 # enter the debugger when we hit an exception |
478 # enter the debugger when we hit an exception |
465 if req.earlyoptions[b'debugger']: |
479 if req.earlyoptions[b'debugger']: |
466 traceback.print_exc() |
480 traceback.print_exc() |
467 debugmortem[debugger](sys.exc_info()[2]) |
481 debugmortem[debugger](sys.exc_info()[2]) |