Skip to content

prompt_async is blocking on windows #505

@eric-wieser

Description

@eric-wieser

Consider the following:

import asyncio

from prompt_toolkit.shortcuts import prompt_async

async def spam():
    while True:
        print("hello");
        await asyncio.sleep(0.1);
        print("World");
        await asyncio.sleep(0.1);


async def my_coroutine():
    while True:
        result = await prompt_async('Say something: ', patch_stdout=True)
        print('You said: %s' % result)

loop = asyncio.get_event_loop()
loop.run_until_complete(asyncio.gather(my_coroutine(), spam()))
loop.close()

What I expect to happen: The prompt is pushed down by a continual stream of Hello and World

What actually happens: Each time I push a single character, an extra Hello or World is printed - the output does not advance while waiting for a single character.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions