wait4 broken on python2.7 / osx?
<p>This program does not do as I expect.  The pid returned from wait4 is zero.</p>

<pre><code>import os
import posix
import signal
import subprocess
import time

os.system('uname -a')
proc = subprocess.Popen(['/bin/sh','-c','while true; do echo hi; sleep 1;done'])
print 'started proc',proc.pid
time.sleep(3)
print 'killing pid',proc.pid
os.kill(proc.pid, signal.SIGTERM)
any_child = -1
wait_options = posix.WNOHANG
pid, status, rusage = posix.wait4(any_child, wait_options)
print 'pid',pid,'status',status
assert pid == proc.pid
</code></pre>

<p>The output on my system is like so:</p>

<pre><code>Darwin ch00mdv0996 10.8.0 Darwin Kernel Version 10.8.0: Tue Jun  7 16:33:36 PDT 2011; root:xnu-1504.15.3~1/RELEASE_I386 i386
hi
started proc 83830
hi
hi
killing pid 83830
pid 0 status 0
Traceback (most recent call last):
  File "foo.py", line 19, in &lt;module&gt;
    assert pid == proc.pid
AssertionError
</code></pre>

<p>Any ideas what I am doing wrong?  I am running python2.7.</p>
