diff options
author | Zac Medico <zmedico@gentoo.org> | 2017-02-08 01:08:07 -0800 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2017-02-08 01:10:49 -0800 |
commit | 855c8761f85323bbe570ae61e87c57dc8ea5ea0e (patch) | |
tree | 3d89878268c9794764a73c9ed5e6312b8f163c00 | |
parent | .travis.yml: test python 3.6 (diff) | |
download | portage-855c8761f85323bbe570ae61e87c57dc8ea5ea0e.tar.gz portage-855c8761f85323bbe570ae61e87c57dc8ea5ea0e.tar.bz2 portage-855c8761f85323bbe570ae61e87c57dc8ea5ea0e.zip |
PopenProcess: suppress ResourceWarning subprocess "still running" (bug 608594)
Override the _set_returncode method to set the Popen.returncode
attribute, in order to suppress Python 3.6 ResourceWarnings which
erroneously report that the subprocess is still running.
X-Gentoo-Bug: 608594
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=608594
-rw-r--r-- | pym/portage/util/_async/PopenProcess.py | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/pym/portage/util/_async/PopenProcess.py b/pym/portage/util/_async/PopenProcess.py index 2fc56d295..4344b1c9d 100644 --- a/pym/portage/util/_async/PopenProcess.py +++ b/pym/portage/util/_async/PopenProcess.py @@ -1,4 +1,4 @@ -# Copyright 2012 Gentoo Foundation +# Copyright 2012-2017 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 from _emerge.SubProcess import SubProcess @@ -31,3 +31,10 @@ class PopenProcess(SubProcess): self._reg_id = None self._waitpid_cb(pid, condition) self.wait() + + def _set_returncode(self, wait_retval): + SubProcess._set_returncode(self, wait_retval) + if self.proc.returncode is None: + # Suppress warning messages like this: + # ResourceWarning: subprocess 1234 is still running + self.proc.returncode = self.returncode |