Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Asyncio subprocess EOF is never received #5

Open
nielsavonds opened this issue May 15, 2020 · 0 comments
Open

Asyncio subprocess EOF is never received #5

nielsavonds opened this issue May 15, 2020 · 0 comments

Comments

@nielsavonds
Copy link

nielsavonds commented May 15, 2020

When running a subprocess using asyncio-glib and having stdout as a PIPE, the EOF is never received. This happens because the selector doesn't listen for the GLib HUP signal.

A minimal non-working example:

import asyncio
from asyncio import subprocess

from asyncio_glib import GLibEventLoopPolicy


async def main():
    proc = await asyncio.create_subprocess_exec('ls', '-la', '/tmp', stdout=subprocess.PIPE)

    async for line in proc.stdout:
        print(line)

    print('DONE')

if __name__ == '__main__':
    asyncio.set_event_loop_policy(GLibEventLoopPolicy())
    asyncio.run(main())

The print('DONE') line is never reached. When running this wihtout the GLibEventLoopPolicy, it does work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant