I\'ve got a command that I\'m wrapping in script and spawning from a Python script using subprocess.Popen. I\'m trying to make sure it dies if the
script
subprocess.Popen
This hack will work, but it's ugly...
Change the command to this:
success_flag = '/tmp/success.flag' cmd = [ 'script', '-q', '-c', "sleep 2 && touch " + success_flag, '/dev/null']
And put
if os.path.isfile( success_flag ) : os.remove( success_flag ) else : return
at the end of the for loop