ruby-changes:57873
From: Nobuyoshi <ko1@a...>
Date: Mon, 23 Sep 2019 19:30:48 +0900 (JST)
Subject: [ruby-changes:57873] 9e4be78ea8 (master): [ruby/io-console] Try fallback to stdout when stdin
https://git.ruby-lang.org/ruby.git/commit/?id=9e4be78ea8 From 9e4be78ea88f882e1562dbb3eeb24304d0049b8d Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada <nobu@r...> 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 diff --git a/ext/io/console/console.c b/ext/io/console/console.c index f5a32a8..cd47f1e 100644 --- a/ext/io/console/console.c +++ b/ext/io/console/console.c @@ -1058,6 +1058,10 @@ direct_query(VALUE io, VALUE query) https://github.com/ruby/ruby/blob/trunk/ext/io/console/console.c#L1058 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 v0.10.2 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/