[PATCH 1 of 1] Replacing select.select() with os.fstat() which works also on windows

Zbynek Winkler zwin at users.sourceforge.net
Tue Sep 27 14:05:38 CDT 2005


# HG changeset patch
# User zbynek at alex.kolej.mff.cuni.cz
# Node ID 838c97b17a4162fb508452ec08a32bb0e0078d5c
# Parent  0e2be889ccd7eaf0c5c1f08b486e02be3ec7358f
Replacing select.select() with os.fstat() which works also on windows.

diff -r 0e2be889ccd7 -r 838c97b17a41 mercurial/sshrepo.py
--- a/mercurial/sshrepo.py	Mon Sep 26 16:52:47 2005 -0700
+++ b/mercurial/sshrepo.py	Tue Sep 27 20:55:48 2005 +0200
@@ -8,7 +8,7 @@
 from node import *
 from remoterepo import *
 from demandload import *
-demandload(globals(), "hg os re select")
+demandload(globals(), "hg os re stat")
 
 class sshrepository(remoterepository):
     def __init__(self, ui, path):
@@ -37,8 +37,8 @@
 
     def readerr(self):
         while 1:
-            r,w,x = select.select([self.pipee], [], [], 0)
-            if not r: break
+            size = os.fstat(self.pipee.fileno())[stat.ST_SIZE]
+            if size == 0: break
             l = self.pipee.readline()
             if not l: break
             self.ui.status("remote: ", l)
@@ -47,8 +47,7 @@
         try:
             self.pipeo.close()
             self.pipei.close()
-            for l in self.pipee:
-                self.ui.status("remote: ", l)
+            readerr()
             self.pipee.close()
         except:
             pass


More information about the Mercurial mailing list