subprocess seems to "detach" / ignore wait()

Mathieu Prevot mathieu.prevot at gmail.com
Wed Aug 20 09:09:11 EDT 2008


Hi there,

it seems that  child.wait() is ignored when

  print "Server running [PID %s]"%(child.pid)
  fpid.write(child.pid)

are between the process creation child = Popen(cmd.split(),
stderr=flog) and child.wait().
It seems to be a bug, doesn't it ?

Mathieu

(I'm running x11vnv with args in the cmd string on FreeBSD 8.0/CURRENT)

flog = open(logfile, 'w')
fpid = open(pidfile, 'w')
try:
  child = Popen(cmd.split(), stderr=flog)
  print "Server running [PID %s]"%(child.pid)
  fpid.write(child.pid)
  child.wait()
except KeyboardInterrupt:
  print "INT sent to vnc server"
finally:
  fpid.close()
  flog.close()
  os.remove(pidfile)
  os.remove(logfile)
  sys.exit(0)



More information about the Python-list mailing list