[oe-commits] [openembedded-core] 05/05: oeqa/utils/commands: Avoid unclosed file warnings

git at git.openembedded.org git at git.openembedded.org
Tue Nov 13 22:58:03 UTC 2018


This is an automated email from the git hooks/post-receive script.

rpurdie pushed a commit to branch master-next
in repository openembedded-core.

commit 6a68c42de08cffbadb59ebda63fa5e19f6e5acef
Author: Richard Purdie <richard.purdie at linuxfoundation.org>
AuthorDate: Tue Nov 13 22:43:25 2018 +0000

    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)
    
    Signed-off-by: Richard Purdie <richard.purdie at linuxfoundation.org>
---
 meta/lib/oeqa/utils/commands.py | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/meta/lib/oeqa/utils/commands.py b/meta/lib/oeqa/utils/commands.py
index 0d9cf23..01add68 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

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Openembedded-commits mailing list