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