Skip to content

Commit cd41ff6

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 487a49f commit cd41ff6

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
@@ -573,8 +573,10 @@ def to_cmd_str(cmd):
573573
for line in iter(proc.stdout.readline, b''):
574574
_log.debug(f"Captured stdout: {line.decode(errors='ignore').rstrip()}")
575575
stdout += line
576+
proc.stdout.close()
576577
if split_stderr:
577578
stderr += proc.stderr.read() or b''
579+
proc.stderr.close()
578580
else:
579581
(stdout, stderr) = proc.communicate(input=stdin)
580582

0 commit comments

Comments
 (0)