Skip to content

Local terminal stdin detatched if ThreadingGroup run includes sleep #1812

@jensenak

Description

@jensenak

I'm using a threading group to run shell commands. After running a script that includes a sleep, the local terminal is left with stdin detached (keystrokes not visible on command line) and the terminal has to be reset.

I've tried this quite a few times and find that it only happens with ThreadingGroups (SerialGroups are okay). The sleep command can be anywhere in a one-liner (first command, middle, last) and can be joined in the one liner with either semicolons, or double ampersand. All of the commands run as expected, but the terminal remains in a bad state.

Strangely, if the previous run exited with an uncaught exception, the terminal will not be affected.

To reproduce:

from fabric import ThreadingGroup as Group

# raise ValueError()
remotes = Group("host1.example.com", "host2.example.com")
result = remotes.run("echo 1; sleep 1; echo 2")

Run the script above. After it exits, type something on the command line. If you see no output, <ctrl>+c and type reset<enter>. To see the post-exception behavior, uncomment the raise line, run the code, comment the line, and run twice more. The first successful run will leave the terminal in a good state. The second will leave stdin detached.

I discovered this issue with sleep in my testing, but it's possible other commands may have the same effect. There's also a chance I'm just doing something wrong. If that's the case, my apologies.

My setup:
python 3.6.4
fabric 2.1.3
OSX 10.13.5, connecting to Ubuntu 14.04

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions