##// END OF EJS Templates
subprocessio: py27+ compat
marcink -
r341:a40eb400 default
parent child Browse files
Show More
@@ -45,7 +45,7 b' class StreamFeeder(Thread):'
45 self.bytes = bytes(source)
45 self.bytes = bytes(source)
46 else: # can be either file pointer or file-like
46 else: # can be either file pointer or file-like
47 if type(source) in (int, long): # file pointer it is
47 if type(source) in (int, long): # file pointer it is
48 ## converting file descriptor (int) stdin into file-like
48 # converting file descriptor (int) stdin into file-like
49 try:
49 try:
50 source = os.fdopen(source, 'rb', 16384)
50 source = os.fdopen(source, 'rb', 16384)
51 except Exception:
51 except Exception:
@@ -118,7 +118,7 b' class InputStreamChunker(Thread):'
118 t = self.target
118 t = self.target
119 cs = self.chunk_size
119 cs = self.chunk_size
120 ccm = self.chunk_count_max
120 ccm = self.chunk_count_max
121 kr = self.keep_reading
121 keep_reading = self.keep_reading
122 da = self.data_added
122 da = self.data_added
123 go = self.go
123 go = self.go
124
124
@@ -129,15 +129,13 b' class InputStreamChunker(Thread):'
129
129
130 while b and go.is_set():
130 while b and go.is_set():
131 if len(t) > ccm:
131 if len(t) > ccm:
132 kr.clear()
132 keep_reading.clear()
133 kr.wait(2)
133 keep_reading.wait(2)
134 # # this only works on 2.7.x and up
134
135 # if not kr.wait(10):
135 if not keep_reading.wait(10):
136 # raise Exception("Timed out while waiting for input to be read.")
136 raise Exception(
137 # instead we'll use this
137 "Timed out while waiting for input to be read.")
138 if len(t) > ccm + 3:
138
139 raise IOError(
140 "Timed out while waiting for input from subprocess.")
141 t.append(b)
139 t.append(b)
142 da.set()
140 da.set()
143 b = s.read(cs)
141 b = s.read(cs)
General Comments 0
You need to be logged in to leave comments. Login now