[issue43884] Cannot cleanly kill a subprocess using high-level asyncio APIs

Ronal Abraham report at bugs.python.org
Sun Apr 18 22:50:04 EDT 2021


Ronal Abraham <ronalabraham at gmail.com> added the comment:

Reproducing the program here:

    import asyncio
    
    async def test():
        process = await asyncio.create_subprocess_shell(
            "sleep 2 && echo done",
            stdout=asyncio.subprocess.PIPE,
        )
        await asyncio.sleep(1)
        process.kill()
        await process.wait()
        # process._transport.close()
    
    asyncio.run(test())

Can I use the high-level API to kill a subprocess cleanly without having to access the protected member process._transport? Seems like an oversight perhaps?

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue43884>
_______________________________________


More information about the Python-bugs-list mailing list