Ruby 命令正在关闭 tty echo

Pau*_*oub 5 bash command-line ruby stty macos

在运行 Ruby 脚本之后,几乎 100% 的时间,bash 命令行似乎都处于非活动状态,而实际上它正在默默地接受我的击键而不向我显示它们。

通过多个操作系统更新,多个版本的 Ruby 都发生了这种情况;目前,我在 OS X 10.9.2 上运行 v1.9.2p29。reset解决问题;clear,等人,不要。

下面的“现在你没有”等是看不见的echo命令的输出。

$ echo Now you see my typing...
Now you see my typing...

$ bundle exec jekyll build
...
done.

$ This is the output of an unseen echo command

$ About to run "reset"

$ echo And we''re back.
And we're back.
Run Code Online (Sandbox Code Playgroud)

stty -a 工作正常时的输出:

speed 9600 baud; 57 rows; 187 columns;
lflags: icanon isig -iexten echo echoe echok echoke -echonl echoctl
    -echoprt -altwerase -noflsh -tostop -flusho pendin -nokerninfo
    -extproc
iflags: -istrip icrnl -inlcr -igncr ixon -ixoff -ixany imaxbel iutf8
    -ignbrk brkint -inpck ignpar -parmrk
oflags: opost onlcr oxtabs onocr onlret
cflags: cread cs8 -parenb -parodd hupcl -clocal -cstopb -crtscts -dsrflow
    -dtrflow -mdmbuf
cchars: discard = ^O; dsusp = <undef>; eof = ^D; eol = <undef>;
    eol2 = <undef>; erase = ^?; intr = ^C; kill = ^U; lnext = ^V;
    min = 1; quit = ^\; reprint = ^R; start = ^Q; status = <undef>;
    stop = ^S; susp = ^Z; time = 0; werase = ^W;
Run Code Online (Sandbox Code Playgroud)

stty -a 当事情不是这样时的输出:

speed 9600 baud; 57 rows; 187 columns;
lflags: -icanon isig -iexten -echo echoe -echok echoke -echonl echoctl
    -echoprt -altwerase -noflsh -tostop -flusho pendin -nokerninfo
    -extproc
iflags: -istrip icrnl inlcr -igncr ixon -ixoff -ixany imaxbel iutf8
    -ignbrk brkint -inpck ignpar -parmrk
oflags: opost onlcr oxtabs onocr onlret
cflags: cread cs8 -parenb -parodd hupcl -clocal -cstopb -crtscts -dsrflow
    -dtrflow -mdmbuf
cchars: discard = ^O; dsusp = <undef>; eof = <undef>; eol = <undef>;
    eol2 = <undef>; erase = ^?; intr = ^C; kill = ^U;
    lnext = <undef>; min = 1; quit = ^\; reprint = <undef>;
    start = ^Q; status = <undef>; stop = ^S; susp = ^Z; time = 0;
    werase = <undef>;
Run Code Online (Sandbox Code Playgroud)

我特别注意到,在lflagsecho已成为-echo

不确定是什么原因导致的,或者我应该检查哪些其他设置/诊断。

slm*_*slm 0

当您在提示中键入以下内容时:

$ And now you don't.
> 
Run Code Online (Sandbox Code Playgroud)

这将触发命令行继续。您显然没有在 OSX 上设置辅助提示(我猜是提示的事情),但您的问题是因为您正在使用特定的字符串“$ And now you don't.`”。

当你输入以下内容时:

$ echo And we''re back.
And were back.
Run Code Online (Sandbox Code Playgroud)

你正在关闭延续。尝试使用不同的字符串来查看是否存在相同的问题。

注意:最根本的问题是您对'....'.