Skip to content

Commit aaa5ea1

Browse files
committed
Close file handles for run_shell_cmd
The stdin/stdout/stderr handles need be closed by calling `communicate`. Otherwise the handles will be leaked and e.g. `test_run_shell_cmd_qa_trace` fails because it may capture a related warning.
1 parent 621a5c3 commit aaa5ea1

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

easybuild/tools/run.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -580,8 +580,10 @@ def to_cmd_str(cmd):
580580
for line in iter(proc.stdout.readline, b''):
581581
_log.debug(f"Captured stdout: {line.decode(errors='ignore').rstrip()}")
582582
stdout += line
583+
proc.stdout.close()
583584
if split_stderr:
584585
stderr += proc.stderr.read() or b''
586+
proc.stderr.close()
585587
else:
586588
(stdout, stderr) = proc.communicate(input=stdin)
587589

0 commit comments

Comments
 (0)