# HG changeset patch
# User Matt Harbison <matt_harbi...@yahoo.com>
# Date 1520703910 18000
#      Sat Mar 10 12:45:10 2018 -0500
# Node ID 0e076d66888bff8e3eac166454bb3214c48ff8be
# Parent  e21d0c21f81315d012c4806359bc76aa40c89ad6
sshpeer: check pipe validity before forwarding output from it

After the previous fix, fileobjectproxy._observedcall() (called when
win32.peekpipe() accesses .fileno) started exploding.  With this fix, similar
checks are needed inside debugwireproto().  Since that is hardcoded to not use
os.devnull, IDK if those are worth fixing.

diff --git a/mercurial/sshpeer.py b/mercurial/sshpeer.py
--- a/mercurial/sshpeer.py
+++ b/mercurial/sshpeer.py
@@ -32,10 +32,11 @@ def _forwardoutput(ui, pipe):
     """display all data currently available on pipe as remote output.
 
     This is non blocking."""
-    s = util.readpipe(pipe)
-    if s:
-        for l in s.splitlines():
-            ui.status(_("remote: "), l, '\n')
+    if pipe:
+        s = util.readpipe(pipe)
+        if s:
+            for l in s.splitlines():
+                ui.status(_("remote: "), l, '\n')
 
 class doublepipe(object):
     """Operate a side-channel pipe in addition of a main one
_______________________________________________
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel

Reply via email to