ovs-bugtool: Close file descriptors after use.
authorGurucharan Shetty <gshetty@nicira.com>
Fri, 11 May 2012 21:49:02 +0000 (14:49 -0700)
committerGurucharan Shetty <gshetty@nicira.com>
Fri, 11 May 2012 21:49:02 +0000 (14:49 -0700)
In ovs-bugtool, we do a bunch of Popen calls to
get the results of some shell commands with stdout
set to PIPE. Once we are done, we need to
close the file descriptors.

Bug #11083.
Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
utilities/bugtool/ovs-bugtool.in

index 2df3e66bebd2804f8497a45e2e826e536d373666..3daf9ccab397d84fb56887467539bc441b8c07af 100755 (executable)
@@ -1175,6 +1175,7 @@ class ProcOutput:
     def terminate(self):
         if self.running:
             try:
+                self.proc.stdout.close()
                 os.kill(self.proc.pid, SIGTERM)
             except:
                 pass
@@ -1187,6 +1188,7 @@ class ProcOutput:
         line = self.proc.stdout.readline()
         if line == '':
             # process exited
+            self.proc.stdout.close()
             self.status = self.proc.wait()
             self.proc = None
             self.running = False