Gentoo Archives: gentoo-commits

From: Zac Medico <zmedico@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/portage:master commit in: pym/portage/util/_async/
Date: Wed, 08 Feb 2017 09:39:59
Message-Id: 1486545049.855c8761f85323bbe570ae61e87c57dc8ea5ea0e.zmedico@gentoo
1 commit: 855c8761f85323bbe570ae61e87c57dc8ea5ea0e
2 Author: Zac Medico <zmedico <AT> gentoo <DOT> org>
3 AuthorDate: Wed Feb 8 09:08:07 2017 +0000
4 Commit: Zac Medico <zmedico <AT> gentoo <DOT> org>
5 CommitDate: Wed Feb 8 09:10:49 2017 +0000
6 URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=855c8761
7
8 PopenProcess: suppress ResourceWarning subprocess "still running" (bug 608594)
9
10 Override the _set_returncode method to set the Popen.returncode
11 attribute, in order to suppress Python 3.6 ResourceWarnings which
12 erroneously report that the subprocess is still running.
13
14 X-Gentoo-Bug: 608594
15 X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=608594
16
17 pym/portage/util/_async/PopenProcess.py | 9 ++++++++-
18 1 file changed, 8 insertions(+), 1 deletion(-)
19
20 diff --git a/pym/portage/util/_async/PopenProcess.py b/pym/portage/util/_async/PopenProcess.py
21 index 2fc56d295..4344b1c9d 100644
22 --- a/pym/portage/util/_async/PopenProcess.py
23 +++ b/pym/portage/util/_async/PopenProcess.py
24 @@ -1,4 +1,4 @@
25 -# Copyright 2012 Gentoo Foundation
26 +# Copyright 2012-2017 Gentoo Foundation
27 # Distributed under the terms of the GNU General Public License v2
28
29 from _emerge.SubProcess import SubProcess
30 @@ -31,3 +31,10 @@ class PopenProcess(SubProcess):
31 self._reg_id = None
32 self._waitpid_cb(pid, condition)
33 self.wait()
34 +
35 + def _set_returncode(self, wait_retval):
36 + SubProcess._set_returncode(self, wait_retval)
37 + if self.proc.returncode is None:
38 + # Suppress warning messages like this:
39 + # ResourceWarning: subprocess 1234 is still running
40 + self.proc.returncode = self.returncode