close open filehandles. more tests

This commit is contained in:
Edwin Eefting
2020-05-17 16:59:46 +02:00
parent 2305fdf033
commit 138c913e58
4 changed files with 24 additions and 4 deletions

View File

@ -435,12 +435,16 @@ class ExecuteNode(Logger):
if p.poll()!=None and ((not isinstance(input, subprocess.Popen)) or input.poll()!=None) and eof_count==len(selectors):
break
p.stderr.close()
p.stdout.close()
if self.debug_output:
self.debug("EXIT > {}".format(p.returncode))
#handle piped process error output and exit codes
if isinstance(input, subprocess.Popen):
input.stderr.close()
input.stdout.close()
if self.debug_output:
self.debug("EXIT |> {}".format(input.returncode))
@ -450,7 +454,6 @@ class ExecuteNode(Logger):
if valid_exitcodes and p.returncode not in valid_exitcodes:
raise(subprocess.CalledProcessError(p.returncode, encoded_cmd))
if return_stderr:
return ( output_lines, error_lines )