From 76d7cf2415891fe4df226595c8ad3fc7d4fc7a90 Mon Sep 17 00:00:00 2001 From: Richard Purdie Date: Tue, 13 Nov 2018 22:43:25 +0000 Subject: oeqa/utils/commands: Avoid unclosed file warnings Avoid warnings such as: meta/lib/oeqa/utils/commands.py:213: ResourceWarning: unclosed file <_io.BufferedReader name=4> return runCmd(cmd, ignore_status, timeout, output_log=output_log, **options) (From OE-Core rev: 6a68c42de08cffbadb59ebda63fa5e19f6e5acef) (From OE-Core rev: 682d7b2810b235e86a28a8afe034e3853dbe8c45) Signed-off-by: Richard Purdie --- meta/lib/oeqa/utils/commands.py | 3 +++ 1 file changed, 3 insertions(+) (limited to 'meta/lib') diff --git a/meta/lib/oeqa/utils/commands.py b/meta/lib/oeqa/utils/commands.py index da705295bc..2e6a2289cd 100644 --- a/meta/lib/oeqa/utils/commands.py +++ b/meta/lib/oeqa/utils/commands.py @@ -146,6 +146,9 @@ class Command(object): # At this point we know that the process has closed stdout/stderr, so # it is safe and necessary to wait for the actual process completion. self.status = self.process.wait() + self.process.stdout.close() + if self.process.stderr: + self.process.stderr.close() self.log.debug("Command '%s' returned %d as exit code." % (self.cmd, self.status)) # logging the complete output is insane -- cgit v1.2.3-54-g00ecf