backout: backed out changeset 2f2107c01dee
authorRaphaël Gomès <rgomes@octobus.net>
Tue, 19 Oct 2021 19:03:39 +0200
changeset 48256 56d037d07395
parent 48255 8c34edb1ad10
child 48257 f45d35950db6
backout: backed out changeset 2f2107c01dee After discussion on the original phab patch, we've decided to wait until Python 2 support is dropped to do this since the behavior differs for relatively obscure reasons. Differential Revision: https://phab.mercurial-scm.org/D11692
mercurial/dispatch.py
tests/test-pager.t
--- a/mercurial/dispatch.py	Tue Oct 19 19:04:11 2021 +0200
+++ b/mercurial/dispatch.py	Tue Oct 19 19:03:39 2021 +0200
@@ -252,14 +252,9 @@
         err = e
         status = -1
 
-    # Somehow we have to catcht he exception here; catching it inside
-    # _flushstdio() doesn't work.
-    try:
-        ret = _flushstdio(req.ui, err)
-        if ret and not status:
-            status = ret
-    except BaseException:
-        pass
+    ret = _flushstdio(req.ui, err)
+    if ret and not status:
+        status = ret
     return status
 
 
@@ -319,10 +314,7 @@
             ret = -1
         finally:
             duration = util.timer() - starttime
-            try:
-                req.ui.flush()  # record blocked times
-            except BaseException:
-                pass
+            req.ui.flush()  # record blocked times
             if req.ui.logblockedtimes:
                 req.ui._blockedtimes[b'command_duration'] = duration * 1000
                 req.ui.log(
@@ -346,10 +338,7 @@
             except:  # exiting, so no re-raises
                 ret = ret or -1
             # do flush again since ui.log() and exit handlers may write to ui
-            try:
-                req.ui.flush()
-            except BaseException:
-                pass
+            req.ui.flush()
         return ret
 
 
@@ -470,10 +459,7 @@
                 try:
                     return _dispatch(req)
                 finally:
-                    try:
-                        ui.flush()  # record blocked times
-                    except BaseException:
-                        pass
+                    ui.flush()
             except:  # re-raises
                 # enter the debugger when we hit an exception
                 if req.earlyoptions[b'debugger']:
--- a/tests/test-pager.t	Tue Oct 19 19:04:11 2021 +0200
+++ b/tests/test-pager.t	Tue Oct 19 19:03:39 2021 +0200
@@ -219,7 +219,8 @@
 #endif
 
 A complicated pager command gets worse behavior. Bonus points if you can
-improve this.
+improve this. Windows apparently does this better, but only sometimes?
+#if windows
   $ hg log --limit 3 \
   >   --config pager.pager='this-command-better-never-exist --seriously' \
   >  2>/dev/null || true
@@ -239,6 +240,11 @@
   date:        Thu Jan 01 00:00:00 1970 +0000 (?)
   summary:     modify a 8 (?)
    (?)
+#else
+  $ hg log --limit 3 \
+  >   --config pager.pager='this-command-better-never-exist --seriously' \
+  >  2>/dev/null || true
+#endif
 
 Pager works with shell aliases.