From: Oleg Broytman Date: Sat, 1 Jul 2017 00:39:10 +0000 (+0300) Subject: Fix(subproc.py): Carefully close file descriptors X-Git-Tag: 5.0.0~107 X-Git-Url: https://git.phdru.name/?a=commitdiff_plain;h=22d6a7d40652eb92265cb03f2a719974e86bcb4f;p=bookmarks_db.git Fix(subproc.py): Carefully close file descriptors Use os.fdopen() to determine if a file descriptor is valid. --- diff --git a/subproc.py b/subproc.py index 57a9568..b5944f9 100755 --- a/subproc.py +++ b/subproc.py @@ -328,7 +328,11 @@ class Subprocess: (sig[0], self.pid, self.cmd, hex(id(self))[2:]))) for i in self.pipefiles: - os.close(i) + try: + fp = os.fdopen(i).close() + except OSError: + pass + del self.pipefiles[:] self.pid = 0 return None # ===> time.sleep(.1)