Re: subprocess seems to "detach" / ignore wait()

2008-08-21 Thread Mathieu Prevot
2008/8/21 Gabriel Genellina <[EMAIL PROTECTED]>: > En Thu, 21 Aug 2008 02:46:06 -0300, Mathieu Prevot <[EMAIL PROTECTED]> > escribió: > >>> So what is the right thing to do so my script >>> returns 1 or 0 depending on its state and success ? > > I use something like this: > > def main(argv): > tr

Re: subprocess seems to "detach" / ignore wait()

2008-08-21 Thread Gabriel Genellina
En Thu, 21 Aug 2008 02:46:06 -0300, Mathieu Prevot <[EMAIL PROTECTED]> escribió: >> So what is the right thing to do so my script >> returns 1 or 0 depending on its state and success ? I use something like this: def main(argv): try: try: do_things() return 0 finally:

Re: subprocess seems to "detach" / ignore wait()

2008-08-20 Thread Mathieu Prevot
2008/8/21 Mathieu Prevot <[EMAIL PROTECTED]>: > 2008/8/20 Gabriel Genellina <[EMAIL PROTECTED]>: >> En Wed, 20 Aug 2008 12:22:16 -0300, Wojtek Walczak <[EMAIL PROTECTED]> >> escribió: >> >>> On Wed, 20 Aug 2008 15:09:11 +0200, Mathieu Prevot wrote: >>> child = Popen(cmd.split(), stderr=flog

Re: subprocess seems to "detach" / ignore wait()

2008-08-20 Thread Mathieu Prevot
2008/8/20 Gabriel Genellina <[EMAIL PROTECTED]>: > En Wed, 20 Aug 2008 12:22:16 -0300, Wojtek Walczak <[EMAIL PROTECTED]> > escribió: > >> On Wed, 20 Aug 2008 15:09:11 +0200, Mathieu Prevot wrote: >> >>> child = Popen(cmd.split(), stderr=flog) >>> print "Server running [PID %s]"%(child.pid) >>

Re: subprocess seems to "detach" / ignore wait()

2008-08-20 Thread Gabriel Genellina
En Wed, 20 Aug 2008 12:22:16 -0300, Wojtek Walczak <[EMAIL PROTECTED]> escribió: > On Wed, 20 Aug 2008 15:09:11 +0200, Mathieu Prevot wrote: > >> child = Popen(cmd.split(), stderr=flog) >> print "Server running [PID %s]"%(child.pid) >> fpid.write(child.pid) > > I think that the problem here

Re: subprocess seems to "detach" / ignore wait()

2008-08-20 Thread Wojtek Walczak
On Wed, 20 Aug 2008 15:09:11 +0200, Mathieu Prevot wrote: > 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) What happens if you change: fpid.write(child.pid) into:

subprocess seems to "detach" / ignore wait()

2008-08-20 Thread Mathieu Prevot
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