Mercurial > hg
comparison mercurial/dispatch.py @ 34532:b09b3eaf9c96
py3: work around the scope of exception variable in dispatch.run()
https://stackoverflow.com/questions/29268892/
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Mon, 02 Oct 2017 06:52:10 +0100 |
parents | a57c938e7ac8 |
children | 163fa0aea71e |
comparison
equal
deleted
inserted
replaced
34531:50788d1ae6cc | 34532:b09b3eaf9c96 |
---|---|
77 "run the command in sys.argv" | 77 "run the command in sys.argv" |
78 req = request(pycompat.sysargv[1:]) | 78 req = request(pycompat.sysargv[1:]) |
79 err = None | 79 err = None |
80 try: | 80 try: |
81 status = (dispatch(req) or 0) & 255 | 81 status = (dispatch(req) or 0) & 255 |
82 except error.StdioError as err: | 82 except error.StdioError as e: |
83 err = e | |
83 status = -1 | 84 status = -1 |
84 if util.safehasattr(req.ui, 'fout'): | 85 if util.safehasattr(req.ui, 'fout'): |
85 try: | 86 try: |
86 req.ui.fout.flush() | 87 req.ui.fout.flush() |
87 except IOError as err: | 88 except IOError as e: |
89 err = e | |
88 status = -1 | 90 status = -1 |
89 if util.safehasattr(req.ui, 'ferr'): | 91 if util.safehasattr(req.ui, 'ferr'): |
90 if err is not None and err.errno != errno.EPIPE: | 92 if err is not None and err.errno != errno.EPIPE: |
91 req.ui.ferr.write('abort: %s\n' % | 93 req.ui.ferr.write('abort: %s\n' % |
92 encoding.strtolocal(err.strerror)) | 94 encoding.strtolocal(err.strerror)) |