summaryrefslogtreecommitdiffstats
path: root/pym/_emerge
diff options
context:
space:
mode:
Diffstat (limited to 'pym/_emerge')
-rw-r--r--pym/_emerge/SubProcess.py10
-rw-r--r--pym/_emerge/actions.py5
2 files changed, 12 insertions, 3 deletions
diff --git a/pym/_emerge/SubProcess.py b/pym/_emerge/SubProcess.py
index 0013d7391..b2b19d54d 100644
--- a/pym/_emerge/SubProcess.py
+++ b/pym/_emerge/SubProcess.py
@@ -25,6 +25,9 @@ class SubProcess(AbstractPollTask):
return self.returncode
try:
+ # With waitpid and WNOHANG, only check the
+ # first element of the tuple since the second
+ # element may vary (bug #337465).
retval = os.waitpid(self.pid, os.WNOHANG)
except OSError as e:
if e.errno != errno.ECHILD:
@@ -32,7 +35,7 @@ class SubProcess(AbstractPollTask):
del e
retval = (self.pid, 1)
- if retval == (0, 0):
+ if retval[0] == 0:
return None
self._set_returncode(retval)
return self.returncode
@@ -81,6 +84,9 @@ class SubProcess(AbstractPollTask):
return self.returncode
try:
+ # With waitpid and WNOHANG, only check the
+ # first element of the tuple since the second
+ # element may vary (bug #337465).
wait_retval = os.waitpid(self.pid, os.WNOHANG)
except OSError as e:
if e.errno != errno.ECHILD:
@@ -88,7 +94,7 @@ class SubProcess(AbstractPollTask):
del e
self._set_returncode((self.pid, 1))
else:
- if wait_retval != (0, 0):
+ if wait_retval[0] != 0:
self._set_returncode(wait_retval)
else:
try:
diff --git a/pym/_emerge/actions.py b/pym/_emerge/actions.py
index eb02a0304..92eb18b74 100644
--- a/pym/_emerge/actions.py
+++ b/pym/_emerge/actions.py
@@ -2177,7 +2177,10 @@ def action_sync(settings, trees, mtimedb, myopts, myaction):
except portage.exception.AlarmSignal:
# timed out
print('timed out')
- if mypids and os.waitpid(mypids[0], os.WNOHANG) == (0,0):
+ # With waitpid and WNOHANG, only check the
+ # first element of the tuple since the second
+ # element may vary (bug #337465).
+ if mypids and os.waitpid(mypids[0], os.WNOHANG)[0] == 0:
os.kill(mypids[0], signal.SIGTERM)
os.waitpid(mypids[0], 0)
# This is the same code rsync uses for timeout.