summaryrefslogtreecommitdiff
path: root/ext/readline
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-01-12 07:48:06 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-01-12 07:48:06 +0000
commit0d354933c5ec267ef66f012a721a9ac6343fe279 (patch)
treec8552838a16f4955d5f3bcf60ba9efc6bb43aeba /ext/readline
parent8f3f9d715f39ccafaa576b245865b70c272fc047 (diff)
* ext/readline/readline.c (readline_readline): check if instream
is closed instead of fd 0. * ext/readline/readline.c (Init_readline): use STDIN for input. http://d.hatena.ne.jp/codnote/20100111/1263174134 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26300 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/readline')
-rw-r--r--ext/readline/readline.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/ext/readline/readline.c b/ext/readline/readline.c
index abb9a0a..ff30be1 100644
--- a/ext/readline/readline.c
+++ b/ext/readline/readline.c
@@ -247,7 +247,7 @@ readline_readline(int argc, VALUE *argv, VALUE self)
prompt = RSTRING_PTR(tmp);
}
- if (!isatty(0) && errno == EBADF) rb_raise(rb_eIOError, "closed stdin");
+ if (!isatty(fileno(rl_instream)) && errno == EBADF) rb_raise(rb_eIOError, "closed stdin");
#ifdef _WIN32
rl_prep_terminal(1);
@@ -1463,4 +1463,6 @@ Init_readline()
#ifdef HAVE_RL_CLEAR_SIGNALS
rl_clear_signals();
#endif
+
+ readline_s_set_input(mReadline, rb_stdin);
}