Make sure we 'sudo kill' our sudo pexpect process in close().
This should more reliably shut down pexpect subprocesses when build.py exits before completion.
This commit is contained in:
+6
-1
@@ -441,7 +441,12 @@ def boot( cow, kernel, initrd, logfile, memory=1024 ):
|
|||||||
returns: pexpect object to qemu process"""
|
returns: pexpect object to qemu process"""
|
||||||
# pexpect might not be installed until after depend() is called
|
# pexpect might not be installed until after depend() is called
|
||||||
global pexpect
|
global pexpect
|
||||||
|
if not pexpect:
|
||||||
import pexpect
|
import pexpect
|
||||||
|
class Spawn( pexpect.spawn ):
|
||||||
|
"Subprocess is sudo, so we have to sudo kill it"
|
||||||
|
def close( self, force=False ):
|
||||||
|
srun( 'kill %d' % self.pid )
|
||||||
arch = archFor( kernel )
|
arch = archFor( kernel )
|
||||||
log( '* Detected kernel architecture', arch )
|
log( '* Detected kernel architecture', arch )
|
||||||
if NoKVM:
|
if NoKVM:
|
||||||
@@ -462,7 +467,7 @@ def boot( cow, kernel, initrd, logfile, memory=1024 ):
|
|||||||
cmd = ' '.join( cmd )
|
cmd = ' '.join( cmd )
|
||||||
log( '* BOOTING VM FROM', cow )
|
log( '* BOOTING VM FROM', cow )
|
||||||
log( cmd )
|
log( cmd )
|
||||||
vm = pexpect.spawn( cmd, timeout=TIMEOUT, logfile=logfile )
|
vm = Spawn( cmd, timeout=TIMEOUT, logfile=logfile )
|
||||||
return vm
|
return vm
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user