Hi Brian, Couple of things. You should use poll() on the Popen instance, and should check it explicitly against None (since a 0 return code, meaning exit successfully, will be treated as a false condition the same as None). Also, in your second example, you block the program when you call readlines on the pipe, since readlines blocks until it reaches eof (i.e., until pipe closes stdout, i.e., process is complete). Oh, and you don't have to split the input to the args option yourself, you can just pass a string. So, putting it all together, you want something like:
import subprocess, time cmd = "cat somefile" proc = subprocess.Popen(args=cmd, shell=True, stdout=subprocess.PIPE, stdin=subprocess.PIPE, stderr=subprocess.STDOUT, close_fds=True) while 1: time.sleep(1) if proc.poll() != None: break else: print "waiting on child..." print "returncode =", proc.returncode HTH, Jordan -- http://mail.python.org/mailman/listinfo/python-list