From 9e4be78ea88f882e1562dbb3eeb24304d0049b8d Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada Date: Mon, 23 Sep 2019 19:27:18 +0900 Subject: [ruby/io-console] Try fallback to stdout when stdin https://github.com/ruby/io-console/commit/b8017509ef --- ext/io/console/console.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'ext/io/console/console.c') diff --git a/ext/io/console/console.c b/ext/io/console/console.c index f5a32a8fbb..cd47f1e3d0 100644 --- a/ext/io/console/console.c +++ b/ext/io/console/console.c @@ -1058,6 +1058,10 @@ direct_query(VALUE io, VALUE query) if (write(fptr->fd, RSTRING_PTR(query), RSTRING_LEN(query)) != -1) { return 1; } + if (fptr->fd == 0 && + write(1, RSTRING_PTR(query), RSTRING_LEN(query)) != -1) { + return 1; + } } return 0; } -- cgit v1.2.3