close
Skip to content

Blocking when running commands looking for stdin close #552

@plockc

Description

@plockc

Example:

@task
def cat(c):
    c.run("cat")
echo Hi | timeout 3 invoke cat || echo failed

This prints Hi but never exits because cat never receives a close of stdin and is waiting for more, and invoke is waiting on the subprocess.

In a different issue, I notice that the console has trouble after running the above command

Caused by two bugs:

First is that ExceptionHandlingThread.is_dead return expression is wrong, it should be "or" instead of "and":
https://github.com/pyinvoke/invoke/blob/master/invoke/util.py#L274

Second, is that the stdin for the process is not closed after receiving EOF:
https://github.com/pyinvoke/invoke/blob/master/invoke/runners.py#L659

Python 3.6.5
Ubuntu 18.04
Invoke 1.0.0.0

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions