Fabric: open_shell not working with nano or vim

Created on 17 Feb 2018  ·  5Comments  ·  Source: fabric/fabric

I am having this weird issue when I use open_shell() with nano.

The arrow keys do not seem to work right. When I use the up arrow, for example, nothing happens the first press and the second press gives me the letter 'A'

This issue also appeared with vim as well.

I was able to capture this in motion when I use the showkey -a command below.

I am currently using Fabric3 1.14.post1

## When Ran with open_shell(command='nano  /home/pi/.piHoleRestore/01-pihole.conf.old')
# THen I exit the Nano Editor

pi@raspberrypi:~$ showkey -a


^[       27 0033 0x1b # Up First arrow Key Press
[        91 0133 0x5b # Up Second Arrow Press
A        65 0101 0x41 #
^[       27 0033 0x1b # Down First arrow Key Press
[        91 0133 0x5b # Down Second Arrow Press
B        66 0102 0x42 #
^[       27 0033 0x1b # Left First arrow Key Press
[        91 0133 0x5b # Left Second Arrow Press
D        68 0104 0x44 # 
^[       27 0033 0x1b # Right First arrow Key Press
[        91 0133 0x5b # Right Second Arrow Press
C        67 0103 0x43 #


# WHen ran with normal ssh session

pi@raspberrypi:~$ showkey -a


^[[A     27 0033 0x1b # Up Arrow
         91 0133 0x5b
         65 0101 0x41
^[[D     27 0033 0x1b # Down Arrow
         91 0133 0x5b
         68 0104 0x44
^[[B     27 0033 0x1b # Left Arrow
         91 0133 0x5b
         66 0102 0x42
^[[C     27 0033 0x1b # Right Arrow
         91 0133 0x5b
         67 0103 0x43

All 5 comments

See https://github.com/fabric/fabric/issues/196, this is a known (and IIRC
de-prioritized?) issue. I think it's useful to have some of the problem
documented though. I really find it annoying myself.

On Feb 16, 2018 11:48 PM, "John McGrath" notifications@github.com wrote:

I am having this weird issue when I use open_shell() with nano.

The arrow keys do not seem to work right. When I use the up arrow, for
example, nothing happens the first press and the second press gives me the
letter 'A'

This issue also appeared with vim as well.

I was able to capture this in motion when I use the showkey -a command
below.

I am currently using Fabric3 1.14.post1

When Ran with open_shell(command='nano /home/pi/.piHoleRestore/01-pihole.conf.old')

THen I exit the Nano Editor

pi@raspberrypi:~$ showkey -a

^[ 27 0033 0x1b # Up First arrow Key Press
[ 91 0133 0x5b # Up Second Arrow Press
A 65 0101 0x41 #
^[ 27 0033 0x1b # Down First arrow Key Press
[ 91 0133 0x5b # Down Second Arrow Press
B 66 0102 0x42 #
^[ 27 0033 0x1b # Left First arrow Key Press
[ 91 0133 0x5b # Left Second Arrow Press
D 68 0104 0x44 #
^[ 27 0033 0x1b # Right First arrow Key Press
[ 91 0133 0x5b # Right Second Arrow Press
C 67 0103 0x43 #

WHen ran with normal ssh session

pi@raspberrypi:~$ showkey -a

^[[A 27 0033 0x1b # Up Arrow
91 0133 0x5b
65 0101 0x41
^[[D 27 0033 0x1b # Down Arrow
91 0133 0x5b
68 0104 0x44
^[[B 27 0033 0x1b # Left Arrow
91 0133 0x5b
66 0102 0x42
^[[C 27 0033 0x1b # Right Arrow
91 0133 0x5b
67 0103 0x43


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
https://github.com/fabric/fabric/issues/1719, or mute the thread
https://github.com/notifications/unsubscribe-auth/ABUzl55nzK_drLV4Q8bYs9Azzn1UXZHzks5tVnY2gaJpZM4SJN4T
.

As you read along in that issue history a potential, not-accepted fix was
suggested that you could try. It's just one line.

On Feb 19, 2018 10:56 AM, "Brian Peterson" bepetersn@gmail.com wrote:

See https://github.com/fabric/fabric/issues/196, this is a known (and
IIRC de-prioritized?) issue. I think it's useful to have some of the
problem documented though. I really find it annoying myself.

On Feb 16, 2018 11:48 PM, "John McGrath" notifications@github.com wrote:

I am having this weird issue when I use open_shell() with nano.

The arrow keys do not seem to work right. When I use the up arrow, for
example, nothing happens the first press and the second press gives me the
letter 'A'

This issue also appeared with vim as well.

I was able to capture this in motion when I use the showkey -a command
below.

I am currently using Fabric3 1.14.post1

When Ran with open_shell(command='nano /home/pi/.piHoleRestore/01-pihole.conf.old')

THen I exit the Nano Editor

pi@raspberrypi:~$ showkey -a

^[ 27 0033 0x1b # Up First arrow Key Press
[ 91 0133 0x5b # Up Second Arrow Press
A 65 0101 0x41 #
^[ 27 0033 0x1b # Down First arrow Key Press
[ 91 0133 0x5b # Down Second Arrow Press
B 66 0102 0x42 #
^[ 27 0033 0x1b # Left First arrow Key Press
[ 91 0133 0x5b # Left Second Arrow Press
D 68 0104 0x44 #
^[ 27 0033 0x1b # Right First arrow Key Press
[ 91 0133 0x5b # Right Second Arrow Press
C 67 0103 0x43 #

WHen ran with normal ssh session

pi@raspberrypi:~$ showkey -a

^[[A 27 0033 0x1b # Up Arrow
91 0133 0x5b
65 0101 0x41
^[[D 27 0033 0x1b # Down Arrow
91 0133 0x5b
68 0104 0x44
^[[B 27 0033 0x1b # Left Arrow
91 0133 0x5b
66 0102 0x42
^[[C 27 0033 0x1b # Right Arrow
91 0133 0x5b
67 0103 0x43


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
https://github.com/fabric/fabric/issues/1719, or mute the thread
https://github.com/notifications/unsubscribe-auth/ABUzl55nzK_drLV4Q8bYs9Azzn1UXZHzks5tVnY2gaJpZM4SJN4T
.

@bepetersn Thanks for looking into this for me.

For any other people that come across this issue. Make the change in io.py found in here:

https://github.com/fabric/fabric/pull/1389/commits/8efbff173cdbc5f6f84eb7caeab12b8e1bfded22

Let Hope this change is put in for Fabric V2

Closing issue

Historical note, this sort of thing works significantly better in Invoke and thus the upcoming Fabric 2. I routinely use vim via run() in that codebase.

Was this page helpful?
0 / 5 - 0 ratings