I have a code snippet in which I run a command in background:
from sys import stdout,exit
import pexpect
try:
child=pexpect.spawn("./gmapPlayerCore.r &")
except:
print "Replaytool Execution Failed!!"
exit(1)
child.timeout=Timeout
child.logfile=stdout
status=child.expect(["[nN]o [sS]uch [fF]ile","",pexpect.TIMEOUT,pexpect.EOF])
if status==0:
print "gmapPlayerCore file is missing"
exit(1)
elif status==1:
print "Starting ReplayTool!!!"
else:
print "Timed out!!"
Here, after the script exits the process in the spawn
also gets killed even though it is run in background
How to achieve this?