1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

[ruby/io-console] Try fallback to stdout when stdin

https://github.com/ruby/io-console/commit/b8017509ef
This commit is contained in:
Nobuyoshi Nakada 2019-09-23 19:27:18 +09:00
parent 8487193b10
commit 9e4be78ea8

View file

@ -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;
}