Strange input handling on Windows in Fab2
See original GitHub issueFabric 1 handles manual input correctly, but Fabric 2 behaves strangely, with pty or without.
Python 3.7.0 (v3.7.0:1bf9cc5093, Jun 27 2018, 04:59:51) [MSC v.1914 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
# contents of test_input.sh
# #!/bin/bash
# read -p "enter value: " var
# echo "you entered $var"
# Fabric 1 handled input correctly
>>> run("~/test_input.sh")
[riskapp.comm.equabank.loc] run: ~/test_input.sh
[riskapp.comm.equabank.loc] Login password for 'user':
[riskapp.comm.equabank.loc] out: enter value: foo # typed "foo" ENTER
[riskapp.comm.equabank.loc] out: you entered foo
[riskapp.comm.equabank.loc] out:
'enter value: foo\r\nyou entered foo'
# Fabric 2 without pty doesn't show prompt and behaves strange, must hit enter twice to finish command
>>> c = Connection(SERVER, connect_kwargs={"password": PASSWORD})
>>> c.run("~/test_input.sh")
bar # typed "bar" ENTER
bar # only "b" appeared, the rest after another ENTER
you entered bar
<Result cmd='~/test_input.sh' exited=0>
# Fabric 2 with pty shows prompt but input behavior is still strange, still must hit enter twice
>>> c.run("~/test_input.sh", pty=True)
enter value: baz # typed "baz" ENTER
b # another ENTER
az
you entered baz
<Result cmd='~/test_input.sh' exited=0>
# Fabric 2 automatic response works ok with pty
>>> c.run("~/test_input.sh", pty=True, watchers=[Responder(pattern="enter value", response="foo\n")])
enter value: foo
you entered foo
<Result cmd='~/test_input.sh' exited=0>
Tested on Windows 7 64b in cmd, Python 3.7 64b, with Fabric versions: Fabric3 1.14.post1, Fabric 2.3.1, Paramiko 2.4.1, Invoke 1.1.1
Issue Analytics
- State:
- Created 5 years ago
- Reactions:1
- Comments:11 (1 by maintainers)
Top Results From Across the Web
PhIP-Seq Characterization of Serum Antibodies Using ... - NCBI
B. ELISA is used to quantify each sample's IgG content for normalizing amount of antibody input into each phage binding reaction.
Read more >Fabric - Read the Docs
Fabric is a high level Python (2.7, 3.4+) library designed to execute shell commands remotely over SSH, yielding useful.
Read more >Immunoglobulin F(ab) and F(ab')2 fragments - Abcam
The F(ab) fragment is an antibody structure that still binds to antigens but is monovalent with no Fc portion. An antibody digested by...
Read more >3624, Severity: 20, State: 1. A system assertion check has failed.
b. send minidump to Microsoft for Technical support ... 2018-04-13 18:28:48.10 spid2347 * Input Buffer 255 bytes -
Read more >Untitled
Jewish vote in 2012 election, In the news this week funny, Normand oceanic wiki. ... Civilization 3 windows 7 free download, Vladanko stojakovic...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Here is a breaking change of invoke from 1.2 to 1.3 verion. https://github.com/pyinvoke/invoke/issues/654
Hi,
Any fix on it. We have the same issue as above shown.
2019-08-07 11:31:30,590 - vm-1.0-GA-x86_64-minimal-template-1.0-Update-917-1565202528 - INFO - exec [cd /root || exit $?; mkdir -m 777 -p /mnt/shared-1565202528] testlist: {‘tests’: [{‘test_catagory’: ‘upgrade’, ‘test_json’: ‘runlists/upgrade.json’, ‘priority’: ‘P0’}]} Traceback (most recent call last): File “harness.py”, line 395, in <module> main() File “harness.py”, line 392, in main sys.exit(harness.start_run()) File “harness.py”, line 59, in start_run result_map = self.run() File “harness.py”, line 84, in run result_map[test[‘test_catagory’]] = self.run_tests(test) File “harness.py”, line 127, in run_tests self.mount_storage_on_vm(vm_object) File “harness.py”, line 241, in mount_storage_on_vm “mkdir -m 777 -p %s” % (self.log_location)).return_code == 0: File “/root/workspace/upgrade-test-CI-in-harness/update-basic-in-harness/.venv/lib/python3.6/site-packages/photontools/runner/guest.py”, line 36, in run_with_cd return conn.run(“cd {} || exit $?; {}”.format(quote(dir), command), **args) File “/root/workspace/upgrade-test-CI-in-harness/update-basic-in-harness/.venv/lib/python3.6/site-packages/photontools/runner/vm.py”, line 242, in _pre_run return _orig_run(command, **kwargs) File “<decorator-gen-3>”, line 2, in run File “/root/workspace/upgrade-test-CI-in-harness/update-basic-in-harness/.venv/lib/python3.6/site-packages/fabric/connection.py”, line 30, in opens return method(self, *args, **kwargs) File “/root/workspace/upgrade-test-CI-in-harness/update-basic-in-harness/.venv/lib/python3.6/site-packages/fabric/connection.py”, line 702, in run return self._run(self._remote_runner(), command, **kwargs) File “/root/workspace/upgrade-test-CI-in-harness/update-basic-in-harness/.venv/lib/python3.6/site-packages/invoke/context.py”, line 101, in _run return runner.run(command, **kwargs) File “/root/workspace/upgrade-test-CI-in-harness/update-basic-in-harness/.venv/lib/python3.6/site-packages/invoke/runners.py”, line 291, in run return self._run_body(command, **kwargs) File “/root/workspace/upgrade-test-CI-in-harness/update-basic-in-harness/.venv/lib/python3.6/site-packages/invoke/runners.py”, line 399, in _run_body raise ThreadException(thread_exceptions) invoke.exceptions.ThreadException: Saw 1 exceptions within threads (NotImplementedError):
Thread args: {‘kwargs’: {‘echo’: None, ‘input_’: <_io.TextIOWrapper name=‘<stdin>’ mode=‘r’ encoding=‘UTF-8’>, ‘output’: <_io.TextIOWrapper name=‘<stdout>’ mode=‘w’ encoding=‘UTF-8’>}, ‘target’: <bound method Runner.handle_stdin of <fabric.runners.Remote object at 0x7f38f99f8198>>}
Traceback (most recent call last):
File “/root/workspace/upgrade-test-CI-in-harness/update-basic-in-harness/.venv/lib/python3.6/site-packages/invoke/util.py”, line 233, in run super(ExceptionHandlingThread, self).run()
File “/usr/lib/python3.6/threading.py”, line 864, in run self._target(*self._args, **self._kwargs)
File “/root/workspace/upgrade-test-CI-in-harness/update-basic-in-harness/.venv/lib/python3.6/site-packages/invoke/runners.py”, line 706, in handle_stdin self.close_proc_stdin()
File “/root/workspace/upgrade-test-CI-in-harness/update-basic-in-harness/.venv/lib/python3.6/site-packages/invoke/runners.py”, line 939, in close_proc_stdin raise NotImplementedError
NotImplementedError