# HG changeset patch # User Gregory Szorc # Date 2018-05-12 04:23:48 # Node ID e9c5888025293fc06bc7865e54a11de6b17d12bc # Parent 623dc2651d2627d6801019e9ba9972a9565bf2b3 dispatch: minor code refactor This hopefully makes things slightly easier to read. Differential Revision: https://phab.mercurial-scm.org/D3537 diff --git a/mercurial/dispatch.py b/mercurial/dispatch.py --- a/mercurial/dispatch.py +++ b/mercurial/dispatch.py @@ -87,16 +87,19 @@ def run(): req = request(pycompat.sysargv[1:]) err = None try: - status = (dispatch(req) or 0) + status = dispatch(req) or 0 except error.StdioError as e: err = e status = -1 + + # In all cases we try to flush stdio streams. if util.safehasattr(req.ui, 'fout'): try: req.ui.fout.flush() except IOError as e: err = e status = -1 + if util.safehasattr(req.ui, 'ferr'): try: if err is not None and err.errno != errno.EPIPE: