1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

[ruby/io-console] Set raw mode strictly same as cfmakeraw

* Default VMIN and VTIME to minimum input.
* Disable parity check bits explicitly.
* Disable all bits for flow control on input.

Co-Authored-By: NARUSE, Yui <naruse@airemix.jp>

https://github.com/ruby/io-console/commit/5ce201a686
This commit is contained in:
Nobuyoshi Nakada 2019-12-18 10:25:18 +09:00
parent 254477248c
commit 77e3078ede
2 changed files with 5 additions and 3 deletions

View file

@ -165,11 +165,13 @@ set_rawmode(conmode *t, void *arg)
cfmakeraw(t); cfmakeraw(t);
t->c_lflag &= ~(ECHOE|ECHOK); t->c_lflag &= ~(ECHOE|ECHOK);
#elif defined HAVE_TERMIOS_H || defined HAVE_TERMIO_H #elif defined HAVE_TERMIOS_H || defined HAVE_TERMIO_H
t->c_iflag &= ~(IGNBRK|BRKINT|PARMRK|ISTRIP|INLCR|IGNCR|ICRNL|IXON); t->c_iflag &= ~(IGNBRK|BRKINT|IGNPAR|PARMRK|INPCK|ISTRIP|INLCR|IGNCR|ICRNL|IXON|IXOFF|IXANY|IMAXBEL);
t->c_oflag &= ~OPOST; t->c_oflag &= ~OPOST;
t->c_lflag &= ~(ECHO|ECHOE|ECHOK|ECHONL|ICANON|ISIG|IEXTEN); t->c_lflag &= ~(ECHO|ECHOE|ECHOK|ECHONL|ICANON|ISIG|IEXTEN|XCASE);
t->c_cflag &= ~(CSIZE|PARENB); t->c_cflag &= ~(CSIZE|PARENB);
t->c_cflag |= CS8; t->c_cflag |= CS8;
t->c_cc[VMIN] = 1;
t->c_cc[VTIME] = 0;
#elif defined HAVE_SGTTY_H #elif defined HAVE_SGTTY_H
t->sg_flags &= ~ECHO; t->sg_flags &= ~ECHO;
t->sg_flags |= RAW; t->sg_flags |= RAW;

View file

@ -352,7 +352,7 @@ defined?(PTY) and defined?(IO.console) and TestIO_Console.class_eval do
if cc = ctrl["intr"] if cc = ctrl["intr"]
assert_ctrl("#{cc.ord}", cc, r, w) assert_ctrl("#{cc.ord}", cc, r, w)
assert_ctrl("#{cc.ord}", cc, r, w) assert_ctrl("#{cc.ord}", cc, r, w)
# assert_ctrl("Interrupt", cc, r, w) assert_ctrl("Interrupt", cc, r, w)
end end
if cc = ctrl["dsusp"] if cc = ctrl["dsusp"]
assert_ctrl("#{cc.ord}", cc, r, w) assert_ctrl("#{cc.ord}", cc, r, w)