# HG changeset patch
# User Martin von Zweigbergk <martinvonz@google.com>
# Date 1633725273 25200
#      Fri Oct 08 13:34:33 2021 -0700
# Node ID 8fae2cc6ee8688b882d381d2b8d62e17b4c8411d
# Parent  eb8092f9304f5d961a6342ab02aa098ce6590150
dispatch: don't change error status if flushing stdio fails

If we already have a non-zero exit code, I don't think we should
change it to 255 because we fail to flush stdio. This may not matter
yet, but it will matter when I make a killed pager result in exit code
250 (it's currently 255).

Differential Revision: https://phab.mercurial-scm.org/D11626

diff --git a/mercurial/dispatch.py b/mercurial/dispatch.py
--- a/mercurial/dispatch.py
+++ b/mercurial/dispatch.py
@@ -253,7 +253,7 @@
         status = -1
 
     ret = _flushstdio(req.ui, err)
-    if ret:
+    if ret and not status:
         status = ret
     return status