Fabric: open_shell 不适用于 nano 或 vim

创建于 2018-02-17  ·  5评论  ·  资料来源: fabric/fabric

当我将 open_shell() 与 nano 一起使用时,我遇到了这个奇怪的问题。

箭头键似乎不能正常工作。 例如,当我使用向上箭头时,第一次按下没有任何反应,第二次按下给我字母“A”

这个问题也出现在 vim 中。

当我使用下面的 showkey -a 命令时,我能够捕捉到这个动作。

我目前正在使用 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<strong i="10">@raspberrypi</strong>:~$ 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<strong i="11">@raspberrypi</strong>:~$ 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

所有5条评论

参见https://github.com/fabric/fabric/issues/196 ,这是一个已知的(和 IIRC
取消优先级?)问题。 我认为解决一些问题很有用
虽然有记录。 我自己真的觉得很烦。

2018 年 2 月 16 日晚上 11:48,“John McGrath”通知@ github.com 写道:

当我将 open_shell() 与 nano 一起使用时,我遇到了这个奇怪的问题。

箭头键似乎不能正常工作。 当我使用向上箭头时,对于
例如,第一次按下没有任何反应,第二次按下给我
字母“A”

这个问题也出现在 vim 中。

当我使用 showkey -a 命令时,我能够捕捉到这个动作
以下。

我目前正在使用 Fabric3 1.14.post1

当使用 open_shell(command='nano /home/pi/.piHoleRestore/01-pihole.conf.old') 运行时

然后我退出 Nano Editor

pi@raspberrypi :~$ showkey -a

^[ 27 0033 0x1b #向上第一个箭头键按下
[ 91 0133 0x5b #向上第二箭头按下
一个 65 0101 0x41 #
^[ 27 0033 0x1b #向下第一个箭头键按下
[ 91 0133 0x5b #向下第二箭头按下
B 66 0102 0x42 #
^[ 27 0033 0x1b # 左第一个箭头键按下
[ 91 0133 0x5b # 左第二箭头按下
D 68 0104 0x44 #
^[ 27 0033 0x1b #右第一个箭头键按下
[ 91 0133 0x5b #右第二箭头按下
C 67 0103 0x43 #

使用普通 ssh 会话运行时

pi@raspberrypi :~$ showkey -a

^[[A 27 0033 0x1b #向上箭头
91 0133 0x5b
65 0101 0x41
^[[D 27 0033 0x1b # 向下箭头
91 0133 0x5b
68 0104 0x44
^[[B 27 0033 0x1b # 左箭头
91 0133 0x5b
66 0102 0x42
^[[C 27 0033 0x1b # 右箭头
91 0133 0x5b
67 0103 0x43


您收到此消息是因为您订阅了此线程。
直接回复本邮件,在GitHub上查看
https://github.com/fabric/fabric/issues/1719 ,或静音线程
https://github.com/notifications/unsubscribe-auth/ABUzl55nzK_drLV4Q8bYs9Azzn1UXZHzks5tVnY2gaJpZM4SJN4T
.

当您在该问题历史记录中阅读时,一个潜在的、不被接受的修复是
建议你可以试试。 这只是一行。

2018 年 2 月 19 日上午 10:56,“Brian Peterson” [email protected]写道:

参见https://github.com/fabric/fabric/issues/196 ,这是一个已知的(和
IIRC 取消优先级?)问题。 我认为有一些有用的
问题记录在案。 我自己真的觉得很烦。

2018 年 2 月 16 日晚上 11:48,“John McGrath”通知@ github.com 写道:

当我将 open_shell() 与 nano 一起使用时,我遇到了这个奇怪的问题。

箭头键似乎不能正常工作。 当我使用向上箭头时,对于
例如,第一次按下没有任何反应,第二次按下给我
字母“A”

这个问题也出现在 vim 中。

当我使用 showkey -a 命令时,我能够捕捉到这个动作
以下。

我目前正在使用 Fabric3 1.14.post1

当使用 open_shell(command='nano /home/pi/.piHoleRestore/01-pihole.conf.old') 运行时

然后我退出 Nano Editor

pi@raspberrypi :~$ showkey -a

^[ 27 0033 0x1b #向上第一个箭头键按下
[ 91 0133 0x5b #向上第二箭头按下
一个 65 0101 0x41 #
^[ 27 0033 0x1b #向下第一个箭头键按下
[ 91 0133 0x5b #向下第二箭头按下
B 66 0102 0x42 #
^[ 27 0033 0x1b # 左第一个箭头键按下
[ 91 0133 0x5b # 左第二箭头按下
D 68 0104 0x44 #
^[ 27 0033 0x1b #右第一个箭头键按下
[ 91 0133 0x5b #右第二箭头按下
C 67 0103 0x43 #

使用普通 ssh 会话运行时

pi@raspberrypi :~$ showkey -a

^[[A 27 0033 0x1b #向上箭头
91 0133 0x5b
65 0101 0x41
^[[D 27 0033 0x1b # 向下箭头
91 0133 0x5b
68 0104 0x44
^[[B 27 0033 0x1b # 左箭头
91 0133 0x5b
66 0102 0x42
^[[C 27 0033 0x1b # 右箭头
91 0133 0x5b
67 0103 0x43


您收到此消息是因为您订阅了此线程。
直接回复本邮件,在GitHub上查看
https://github.com/fabric/fabric/issues/1719 ,或静音线程
https://github.com/notifications/unsubscribe-auth/ABUzl55nzK_drLV4Q8bYs9Azzn1UXZHzks5tVnY2gaJpZM4SJN4T
.

@bepetersn感谢您为我调查此事。

对于遇到此问题的任何其他人。 在这里找到的 io.py 中进行更改:

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

让希望此更改适用于 Fabric V2

结题

历史记录,这类事情在 Invoke 和即将推出的 Fabric 2 中效果明显更好。我经常通过该代码库中的run()使用 vim。

此页面是否有帮助?
0 / 5 - 0 等级

相关问题

peteruhnak picture peteruhnak  ·  4评论

supriyopaul picture supriyopaul  ·  4评论

bitprophet picture bitprophet  ·  4评论

omzev picture omzev  ·  6评论

26huitailang picture 26huitailang  ·  3评论