diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2002-06-20 12:14:33 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2002-06-20 12:14:33 +0000 |
commit | a11a0860d1decc554e7fe52aa530c765a57807ff (patch) | |
tree | 0bc062352814602a51708aa057baa0a904122879 /ext | |
parent | 3865afc59b637a84b7a47f46db3a32b295606680 (diff) |
* ext/readline/readline.c (readline_readline): get rid of
libreadline's bug. (ruby-bugs-ja:PR#268)
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_6@2588 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext')
-rw-r--r-- | ext/readline/readline.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/ext/readline/readline.c b/ext/readline/readline.c index 49e3c04fed..b5e749a312 100644 --- a/ext/readline/readline.c +++ b/ext/readline/readline.c @@ -1,6 +1,7 @@ /* readline.c -- GNU Readline module Copyright (C) 1997-1998 Shugo Maeda */ +#include <errno.h> #include <stdio.h> #include <readline/readline.h> #include <readline/history.h> @@ -42,6 +43,9 @@ readline_readline(argc, argv, self) if (rb_scan_args(argc, argv, "02", &tmp, &add_hist) > 0) { prompt = STR2CSTR(tmp); } + + if (!isatty(0) && errno == EBADF) rb_raise(rb_eIOError, "stdin closed"); + buff = readline(prompt); if (RTEST(add_hist) && buff) { add_history(buff); |