This hopefully makes things slightly easier to read.
Details
Details
Diff Detail
Diff Detail
- Repository
- rHG Mercurial
- Lint
Lint Skipped - Unit
Unit Tests Skipped
hg-reviewers |
This hopefully makes things slightly easier to read.
Lint Skipped |
Unit Tests Skipped |
raise exc | raise exc | ||||
def run(): | def run(): | ||||
"run the command in sys.argv" | "run the command in sys.argv" | ||||
initstdio() | initstdio() | ||||
req = request(pycompat.sysargv[1:]) | req = request(pycompat.sysargv[1:]) | ||||
err = None | err = None | ||||
try: | try: | ||||
status = (dispatch(req) or 0) | status = dispatch(req) or 0 | ||||
except error.StdioError as e: | except error.StdioError as e: | ||||
err = e | err = e | ||||
status = -1 | status = -1 | ||||
# In all cases we try to flush stdio streams. | |||||
if util.safehasattr(req.ui, 'fout'): | if util.safehasattr(req.ui, 'fout'): | ||||
try: | try: | ||||
req.ui.fout.flush() | req.ui.fout.flush() | ||||
except IOError as e: | except IOError as e: | ||||
err = e | err = e | ||||
status = -1 | status = -1 | ||||
if util.safehasattr(req.ui, 'ferr'): | if util.safehasattr(req.ui, 'ferr'): | ||||
try: | try: | ||||
if err is not None and err.errno != errno.EPIPE: | if err is not None and err.errno != errno.EPIPE: | ||||
req.ui.ferr.write('abort: %s\n' % | req.ui.ferr.write('abort: %s\n' % | ||||
encoding.strtolocal(err.strerror)) | encoding.strtolocal(err.strerror)) | ||||
req.ui.ferr.flush() | req.ui.ferr.flush() | ||||
# There's not much we can do about an I/O error here. So (possibly) | # There's not much we can do about an I/O error here. So (possibly) | ||||
# change the status code and move on. | # change the status code and move on. |