Lines 4-10
Link Here
|
4 |
# $Id: /var/cvsroot/gentoo-src/portage/pym/portage_exec.py,v 1.13.2.4 2005/04/17 09:01:56 jstubbs Exp $ |
4 |
# $Id: /var/cvsroot/gentoo-src/portage/pym/portage_exec.py,v 1.13.2.4 2005/04/17 09:01:56 jstubbs Exp $ |
5 |
|
5 |
|
6 |
|
6 |
|
7 |
import os,types,atexit,string,stat |
7 |
import os,types,atexit,string,stat,time |
8 |
import signal |
8 |
import signal |
9 |
import portage_data |
9 |
import portage_data |
10 |
import portage_util |
10 |
import portage_util |
Lines 180-194
Link Here
|
180 |
retval=os.waitpid(mypid[-1],0)[1] |
180 |
retval=os.waitpid(mypid[-1],0)[1] |
181 |
if retval != 0: |
181 |
if retval != 0: |
182 |
for x in mypid[0:-1]: |
182 |
for x in mypid[0:-1]: |
183 |
try: |
183 |
for sig in (signal.SIGTERM, signal.SIGKILL): |
184 |
os.kill(x,signal.SIGTERM) |
184 |
timeout = 50 |
185 |
if os.waitpid(x,os.WNOHANG)[1] == 0: |
185 |
while timeout: |
186 |
# feisty bugger, still alive. |
186 |
if os.waitpid(x, os.WNOHANG) != (0,0): |
187 |
os.kill(x,signal.SIGKILL) |
187 |
break |
|
|
188 |
time.sleep(0.01) |
189 |
timeout -= 1 |
190 |
if not timeout: |
191 |
os.kill(x,sig) |
192 |
else: |
193 |
break |
194 |
if not timeout: |
188 |
os.waitpid(x,0) |
195 |
os.waitpid(x,0) |
189 |
except OSError, oe: |
|
|
190 |
if oe.errno not in (10,3): |
191 |
raise oe |
192 |
|
196 |
|
193 |
# at this point we've killed all other kid pids generated via this call. |
197 |
# at this point we've killed all other kid pids generated via this call. |
194 |
# return now. |
198 |
# return now. |