Skip to content

Commit

Permalink
Pipe are closed properly (fix fd leaks)
Browse files Browse the repository at this point in the history
fix #2
  • Loading branch information
bombela committed Apr 12, 2012
1 parent 9fd7821 commit 2a5dac5
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions gevent_subprocess/gevent_subprocess.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ def write(self, data):
data = data[bytes_written:]
except OSError as e:
if e.errno == errno.EPIPE:
self._closed = True
self.close()
raise IOError(e)
if e.errno != errno.EAGAIN:
raise
Expand All @@ -86,7 +86,7 @@ def _read(self, size=-1, greedy=True):
buffer = os.read(self._fd, size if size > 0 else 64 * 1024)
bytes_read = len(buffer)
if bytes_read == 0:
self._closed = True
self.close()
break
if size > 0:
size -= bytes_read
Expand Down

0 comments on commit 2a5dac5

Please sign in to comment.