Subprocess timeout

G

George Sakkis

I'm trying to use a threaded timeout decorator (http://
aspn.activestate.com/ASPN/Cookbook/Python/Recipe/483752) to spawn a
subprocess with a timeout. On a linux box runnning python 2.5 I get
"OSError: [Errno 10] No child processes" on wait(); running the same
program on a different box (again linux) with python 2.4 doesn't throw
an exception. Here's a sample snippet:

import os
from subprocess import Popen,PIPE

@timelimit(3)
def f(cmd):
return Popen(cmd, stdout=PIPE)


p = f('ls')
print os.getpid(), p.pid
# the next line raises OSError on 2.5 but not on 2.4
print os.waitpid(p.pid, 0)

What gives ?

George
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,997
Messages
2,570,239
Members
46,827
Latest member
DMUK_Beginner

Latest Threads

Top