Skip to content

Commit 5cbde4a

Browse files
authored
Merge pull request #48 from ploxiln/always_default_pty
run: change stdin-based pty disable logic
2 parents 1d9458f + 064d7e2 commit 5cbde4a

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
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

tests/test_utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ def test_abort_message_only_printed_once():
9292
# perform when they are allowed to bubble all the way to the top. So, we
9393
# invoke a subprocess and look at its stderr instead.
9494
with quiet():
95-
result = local(sys.executable + " -m fabric.__main__ -f tests/support/aborts.py kaboom", capture=True)
95+
result = local(sys.executable + " -Wignore -m fabric.__main__ -f tests/support/aborts.py kaboom", capture=True)
9696
# When error in #1318 is present, this has an extra "It burns!" at end of
9797
# stderr string.
9898
eq_(result.stderr, "Fatal error: It burns!\n\nAborting.")

0 commit comments

Comments
 (0)