since the second element may vary (bug #337465, comment #12).
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:
del e
retval = (self.pid, 1)
- if retval == (0, 0):
+ if retval[0] == 0:
return None
self._set_returncode(retval)
return self.returncode
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:
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:
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.
while spawned_pids:
pid = spawned_pids.pop()
try:
- if os.waitpid(pid, 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 os.waitpid(pid, os.WNOHANG)[0] == 0:
os.kill(pid, signal.SIGTERM)
os.waitpid(pid, 0)
except OSError:
# If it failed, kill off anything else that
# isn't dead yet.
for pid in mypids:
- if os.waitpid(pid, 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 os.waitpid(pid, os.WNOHANG)[0] == 0:
os.kill(pid, signal.SIGTERM)
os.waitpid(pid, 0)
spawned_pids.remove(pid)