##// END OF EJS Templates
dispatch: assign I/O descriptors from the request to the ui
Idan Kamara -
r14615:9fba795d default
parent child Browse files
Show More
@@ -28,23 +28,39 b' def run():'
28 28
29 29 def dispatch(req):
30 30 "run the command specified in req.args"
31 if req.ferr:
32 ferr = req.ferr
33 elif req.ui:
34 ferr = req.ui.ferr
35 else:
36 ferr = sys.stderr
37
31 38 try:
32 39 if not req.ui:
33 40 req.ui = uimod.ui()
34 41 if '--traceback' in req.args:
35 42 req.ui.setconfig('ui', 'traceback', 'on')
43
44 # set ui streams from the request
45 if req.fin:
46 req.ui.fin = req.fin
47 if req.fout:
48 req.ui.fout = req.fout
49 if req.ferr:
50 req.ui.ferr = req.ferr
36 51 except util.Abort, inst:
37 sys.stderr.write(_("abort: %s\n") % inst)
52 ferr.write(_("abort: %s\n") % inst)
38 53 if inst.hint:
39 sys.stderr.write(_("(%s)\n") % inst.hint)
54 ferr.write(_("(%s)\n") % inst.hint)
40 55 return -1
41 56 except error.ParseError, inst:
42 57 if len(inst.args) > 1:
43 sys.stderr.write(_("hg: parse error at %s: %s\n") %
58 ferr.write(_("hg: parse error at %s: %s\n") %
44 59 (inst.args[1], inst.args[0]))
45 60 else:
46 sys.stderr.write(_("hg: parse error: %s\n") % inst.args[0])
61 ferr.write(_("hg: parse error: %s\n") % inst.args[0])
47 62 return -1
63
48 64 return _runcatch(req)
49 65
50 66 def _runcatch(req):
General Comments 0
You need to be logged in to leave comments. Login now