I don't seem to be able to figure out how to get the exit values of commands executed with pexpect reliably. Here's first with regular shell:
hei...@ubuntu:~$ true; echo $? 0 Let's try with pexpect. Below is the program: ---CLIP--- import sys, pexpect cmd = "true" print 'cmd=', cmd child = pexpect.spawn(cmd, logfile=sys.stdout) child.close() print 'child exitstatus=', child.exitstatus print 'child signalstatus=', child.signalstatus print 'child status=', child.status ---CLIP--- The output: (fabexp)hei...@ubuntu:~/python_virtualenvs/fabexp$ python dep.py cmd= true child exitstatus= 1 child signalstatus= None child status= 256 (fabexp)hei...@ubuntu:~/python_virtualenvs/fabexp$ python dep.py cmd= true child exitstatus= 0 child signalstatus= None child status= 0 (fabexp)hei...@ubuntu:~/python_virtualenvs/fabexp$ python dep.py cmd= true child exitstatus= None child signalstatus= 1 child status= 1 I have tried various other commands, and I just can't seem to be able to get reliable exit codes from commands I execute. Any ideas what is going on? -- Heikki Toivonen - http://heikkitoivonen.net -- http://mail.python.org/mailman/listinfo/python-list