New GitHub issue #119710 from piwicode:<br>

<hr>

<pre>
# Bug report

### Bug description:

On Linux `proc.wait()` does not return after `proc.kill()` when there as sub/sub processes.
This only happens when the standard streams are piped, it looks like `wait()` blocks until the pipes are closed.

```python
import asyncio
import os
import time
async def main():
    proc = await asyncio.create_subprocess_exec(
 "/usr/bin/python3", "-c", "import os;os.system('sleep 20')",
 stdout=asyncio.subprocess.PIPE,
        stderr=asyncio.subprocess.PIPE)
 
    time.sleep(1)
    os.system("ps -f --forest --format pid,ppid,pgid,sid,comm")

    print(f">> This python proces pid={os.getpid()} has a `python3` child process, which has a `sleep` child process.")
    print(f">> Kill the `python3` child process pid={proc.pid}")
    proc.kill()

    os.system("ps -f --forest --format pid,ppid,pgid,sid,comm")
    print(f">> The `python3` child process was killed, the `sleep` process gets orfaned.")
    print(f">> Calling `proc.wait()` or `proc.communicate()` does not return until `sleep` process exits.")
    
    # await proc.wait()
    print(await proc.communicate())

asyncio.run(main())
```

I don't know if it's a documentation issue or a bug.

- It would be more intuitive that `proc.wait()` after a `proc.kill()` returned when the process exited, and does not depend on other processes completion.
- It would be more intuitive to use have the same behavior when standard streams are piped and when they are not.



### CPython versions tested on:

3.11

### Operating systems tested on:

Linux
</pre>

<hr>

<a href="https://github.com/python/cpython/issues/119710">View on GitHub</a>
<p>Labels: type-bug</p>
<p>Assignee: </p>