##// END OF EJS Templates
subprocession: limit fd leaks
marcink -
r624:560860c2 default
parent child Browse files
Show More
@@ -66,15 +66,17 b' class StreamFeeder(Thread):'
66 66
67 67 def run(self):
68 68 t = self.writeiface
69 if self.bytes:
70 os.write(t, self.bytes)
71 else:
72 s = self.source
73 b = s.read(4096)
74 while b:
75 os.write(t, b)
69 try:
70 if self.bytes:
71 os.write(t, self.bytes)
72 else:
73 s = self.source
76 74 b = s.read(4096)
77 os.close(t)
75 while b:
76 os.write(t, b)
77 b = s.read(4096)
78 finally:
79 os.close(t)
78 80
79 81 @property
80 82 def output(self):
@@ -436,6 +438,7 b' class SubprocessIOChunker(object):'
436 438 self.process = _p
437 439 self.output = bg_out
438 440 self.error = bg_err
441 self.inputstream = inputstream
439 442
440 443 def __iter__(self):
441 444 return self
@@ -484,6 +487,10 b' class SubprocessIOChunker(object):'
484 487 self.error.close()
485 488 except:
486 489 pass
490 try:
491 os.close(self.inputstream)
492 except:
493 pass
487 494
488 495 def __del__(self):
489 496 self.close()
General Comments 0
You need to be logged in to leave comments. Login now