mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
fix r42527 again; [Bug #8760] [ruby-dev:47608] [ruby-dev:47609]
Remove check rl_instream != ifp->stdio_file. rl_instream is made from duped fd and we cannnot compare. This fix seems still buggy when rl_instream is manually changed from other extension libraries. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42528 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
0e2a3cccf6
commit
4852e7e673
1 changed files with 2 additions and 7 deletions
|
@ -143,7 +143,6 @@ readline_getc(FILE *input)
|
||||||
VALUE c;
|
VALUE c;
|
||||||
if (!readline_instream) return rl_getc(input);
|
if (!readline_instream) return rl_getc(input);
|
||||||
GetOpenFile(readline_instream, ifp);
|
GetOpenFile(readline_instream, ifp);
|
||||||
if (rl_instream != ifp->stdio_file) return rl_getc(input);
|
|
||||||
#if defined(_WIN32)
|
#if defined(_WIN32)
|
||||||
{
|
{
|
||||||
INPUT_RECORD ir;
|
INPUT_RECORD ir;
|
||||||
|
@ -151,13 +150,13 @@ readline_getc(FILE *input)
|
||||||
static int prior_key = '0';
|
static int prior_key = '0';
|
||||||
for (;;) {
|
for (;;) {
|
||||||
if (prior_key > 0xff) {
|
if (prior_key > 0xff) {
|
||||||
prior_key = rl_getc(ifp->stdio_file);
|
prior_key = rl_getc(rl_instream);
|
||||||
return prior_key;
|
return prior_key;
|
||||||
}
|
}
|
||||||
if (PeekConsoleInput((HANDLE)_get_osfhandle(ifp->fd), &ir, 1, &n)) {
|
if (PeekConsoleInput((HANDLE)_get_osfhandle(ifp->fd), &ir, 1, &n)) {
|
||||||
if (n == 1) {
|
if (n == 1) {
|
||||||
if (ir.EventType == KEY_EVENT && ir.Event.KeyEvent.bKeyDown) {
|
if (ir.EventType == KEY_EVENT && ir.Event.KeyEvent.bKeyDown) {
|
||||||
prior_key = rl_getc(ifp->stdio_file);
|
prior_key = rl_getc(rl_instream);
|
||||||
return prior_key;
|
return prior_key;
|
||||||
} else {
|
} else {
|
||||||
ReadConsoleInput((HANDLE)_get_osfhandle(ifp->fd), &ir, 1, &n);
|
ReadConsoleInput((HANDLE)_get_osfhandle(ifp->fd), &ir, 1, &n);
|
||||||
|
@ -503,8 +502,6 @@ readline_s_set_input(VALUE self, VALUE input)
|
||||||
rb_sys_fail("fdopen");
|
rb_sys_fail("fdopen");
|
||||||
}
|
}
|
||||||
rl_instream = f;
|
rl_instream = f;
|
||||||
if (f == stdin)
|
|
||||||
ifp->stdio_file = f;
|
|
||||||
readline_instream = input;
|
readline_instream = input;
|
||||||
}
|
}
|
||||||
return input;
|
return input;
|
||||||
|
@ -559,8 +556,6 @@ readline_s_set_output(VALUE self, VALUE output)
|
||||||
rb_sys_fail("fdopen");
|
rb_sys_fail("fdopen");
|
||||||
}
|
}
|
||||||
rl_outstream = f;
|
rl_outstream = f;
|
||||||
if (f == stdout)
|
|
||||||
ofp->stdio_file = f;
|
|
||||||
readline_outstream = output;
|
readline_outstream = output;
|
||||||
}
|
}
|
||||||
return output;
|
return output;
|
||||||
|
|
Loading…
Reference in a new issue