]> git.phdru.name Git - bookmarks_db.git/blobdiff - subproc.py
Doc(subproc.py): modified by phd
[bookmarks_db.git] / subproc.py
index c7fd11629c52a526d2cef7b1e1eb63ede7565fac..1828b1c240151e1df7d8a3d8d809e912f6820c6f 100644 (file)
@@ -16,7 +16,7 @@ Subprocess class features:
 
 __version__ = "Revision: 1.15 "
 
-# Id: subproc.py,v 1.15 1998/12/14 20:53:16 klm Exp 
+# Id: subproc.py,v 1.15 1998/12/14 20:53:16 klm Exp
 # Originally by ken manheimer, ken.manheimer@nist.gov, jan 1995.
 
 # Prior art: Initially based python code examples demonstrating usage of pipes
@@ -40,6 +40,9 @@ __version__ = "Revision: 1.15 "
 #
 # ken.manheimer@nist.gov
 
+# This is a modified version by Oleg Broytman <phd@phdru.name>.
+# The original version is still preserved at
+# https://www.python.org/ftp/python/contrib-09-Dec-1999/System/subproc.tar.gz
 
 import sys, os, string, time, types
 import select
@@ -206,7 +209,7 @@ class Subprocess:
             got0 = self.readPendingChars(n)
             got = got + got0
             n = n - len(got0)
-        return got      
+        return got
     def readPendingChars(self, max=None):
         """Read all currently pending subprocess output as a single string."""
         return self.readbuf.readPendingChars(max)
@@ -401,15 +404,15 @@ class ReadBuf:
 
         got = ""
         if self.buf:
-             if (max > 0) and (len(self.buf) > max):
-                 got = self.buf[0:max]
-                 self.buf = self.buf[max:]
-             else:
-                 got, self.buf = self.buf, ''
-             return got                                         
+            if (max > 0) and (len(self.buf) > max):
+                got = self.buf[0:max]
+                self.buf = self.buf[max:]
+            else:
+                got, self.buf = self.buf, ''
+            return got
 
         if self.eof:
-             return ''
+            return ''
 
         sel = select.select([self.fd], [], [self.fd], 0)
         if sel[2]:
@@ -590,7 +593,7 @@ class Ph:
                 line = string.splitfields(line, ':')
                 it[string.strip(line[0])] = (
                     string.strip(string.join(line[1:])))
-        
+
     def getreply(self):
         """Consume next response from ph, returning list of lines or string
         err."""