Stop trying to close the open process

execute_to_log tries to be good and clean up the open file descriptors.
However it would also try and close the subprocess which cleans itself
up. Avoid "IOError: [Errno 9] Bad file descriptor" by skipping over the
subprocess file descriptor.

Change-Id: Iae7d21bbacd07f487fb56592ea12cbd4edb06ca4
This commit is contained in:
Joshua Hesketh
2014-04-08 17:12:02 +10:00
parent e185911f34
commit 6ad492cf57

View File

@@ -186,6 +186,9 @@ def execute_to_log(cmd, logfile, timeout=-1,
# Clean up
for fd, descriptor in descriptors.items():
poll_obj.unregister(fd)
if fd == p.stdout.fileno():
# Don't try and close the process, it'll clean itself up
continue
os.close(fd)
try:
p.kill()