Skip to content

Commit 064d7e2

Browse files
committed
run: change stdin-based pty disable logic
this was recently changed to disable pty when command stdin is not a tty in #23 instead, disable pty when command stdin is not process stdin this gives better backwards compatibility, by always leaving pty enabled by default, when user does not specify a non-default stdin
1 parent a5d68f4 commit 064d7e2

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

fabric/io.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,7 @@ def input_loop(chan, f, using_pty):
272272
if byte:
273273
chan.sendall(byte)
274274
# Optionally echo locally, if needed.
275-
if not using_pty and is_stdin and env.echo_stdin:
275+
if (not using_pty) and is_stdin and env.echo_stdin:
276276
# Not using fastprint() here -- it prints as 'user'
277277
# output level, don't want it to be accidentally hidden
278278
sys.stdout.write(byte)

fabric/operations.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
from fabric.state import env, connections, output, win32, default_channel
2424
from fabric.thread_handling import ThreadHandler
2525
from fabric.utils import (
26-
abort, error, handle_prompt_abort, indent, _pty_size, warn, apply_lcwd, isatty
26+
abort, error, handle_prompt_abort, indent, _pty_size, warn, apply_lcwd,
2727
)
2828

2929

@@ -737,7 +737,7 @@ def _execute(channel, command, pty=True, combine_stderr=None,
737737

738738
# Assume pty use, and allow overriding of this either via kwarg or env
739739
# var. (invoke_shell always wants a pty no matter what.)
740-
using_pty = invoke_shell or (pty and env.always_use_pty and isatty(stdin))
740+
using_pty = invoke_shell or (pty and env.always_use_pty and (stdin is sys.stdin))
741741

742742
# What to do with CTRl-C?
743743
remote_interrupt = env.remote_interrupt

0 commit comments

Comments
 (0)