I replaced some use of Python subprocess.Popen instances with psutil.Popen instances and expected the behaviour to remain the same.
The psutil docs for Popen state:
A more convenient interface to stdlib subprocess.Popen. It starts a sub process and deals with it exactly as when using subprocess.Popen but in addition it also provides all the methods of psutil.Process class in a single interface.
I have found that the return code when terminating a process is not the same, as demonstrated by the sample below.
>>> import subprocess
>>> p = subprocess.Popen('sleep 100', shell=True)
>>> p.kill()
>>> p.wait()
-9
>>>
>>> import psutil
>>> p = psutil.Popen('sleep 100', shell=True)
>>> p.kill()
>>> p.wait()
9
>>>
>>> print sys.version
2.7.3 (default, Aug 28 2012, 13:02:46)
[GCC 4.4.6 20110731 (Red Hat 4.4.6-3)]
>>> print psutil.__version__
2.1.1
What are the POSIX guarantees on exit codes when a process is terminated? Are both the above return codes valid?