From ebc99e026d0ae770b297a93d1f1c1ceeffd13bfc Mon Sep 17 00:00:00 2001 From: Jeremy Evans Date: Thu, 25 Jul 2019 13:47:08 -0700 Subject: Do not change IO.pipe encodings if encodings explicitly given This commit makes it so that if the binmode option is given with any encoding arguments, the reader and writer IO objects are not set to binary encoding. Fixes [Bug #12989] --- io.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'io.c') diff --git a/io.c b/io.c index 00d3716839..d0257ff42e 100644 --- a/io.c +++ b/io.c @@ -10313,7 +10313,7 @@ rb_io_s_pipe(int argc, VALUE *argv, VALUE klass) extract_binmode(opt, &fmode); - if (fmode & FMODE_BINMODE) { + if ((fmode & FMODE_BINMODE) && v1 == Qnil) { rb_io_ascii8bit_binmode(r); rb_io_ascii8bit_binmode(w); } -- cgit v1.2.3