ruby-changes:30449
From: naruse <ko1@a...>
Date: Mon, 12 Aug 2013 11:25:58 +0900 (JST)
Subject: [ruby-changes:30449] naruse:r42528 (trunk): fix r42527 again; [Bug #8760]
naruse 2013-08-12 11:25:49 +0900 (Mon, 12 Aug 2013) New Revision: 42528 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=42528 Log: 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. Modified files: trunk/ext/readline/readline.c Index: ext/readline/readline.c =================================================================== --- ext/readline/readline.c (revision 42527) +++ ext/readline/readline.c (revision 42528) @@ -143,7 +143,6 @@ readline_getc(FILE *input) https://github.com/ruby/ruby/blob/trunk/ext/readline/readline.c#L143 VALUE c; if (!readline_instream) return rl_getc(input); GetOpenFile(readline_instream, ifp); - if (rl_instream != ifp->stdio_file) return rl_getc(input); #if defined(_WIN32) { INPUT_RECORD ir; @@ -151,13 +150,13 @@ readline_getc(FILE *input) https://github.com/ruby/ruby/blob/trunk/ext/readline/readline.c#L150 static int prior_key = '0'; for (;;) { if (prior_key > 0xff) { - prior_key = rl_getc(ifp->stdio_file); + prior_key = rl_getc(rl_instream); return prior_key; } if (PeekConsoleInput((HANDLE)_get_osfhandle(ifp->fd), &ir, 1, &n)) { if (n == 1) { 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; } else { ReadConsoleInput((HANDLE)_get_osfhandle(ifp->fd), &ir, 1, &n); @@ -503,8 +502,6 @@ readline_s_set_input(VALUE self, VALUE i https://github.com/ruby/ruby/blob/trunk/ext/readline/readline.c#L502 rb_sys_fail("fdopen"); } rl_instream = f; - if (f == stdin) - ifp->stdio_file = f; readline_instream = input; } return input; @@ -559,8 +556,6 @@ readline_s_set_output(VALUE self, VALUE https://github.com/ruby/ruby/blob/trunk/ext/readline/readline.c#L556 rb_sys_fail("fdopen"); } rl_outstream = f; - if (f == stdout) - ofp->stdio_file = f; readline_outstream = output; } return output; -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/