>>> import os, subprocess
>>> os.system('touch xyz')
0
>>> x = subprocess.Popen(['touch', 'xyz'])
>>> print x
<subprocess.Popen object at 0x7f29882f6f50>
>>> x.poll()
>>> x.returncode
changes to
outputs the return code