diff options
-rw-r--r-- | ChangeLog | 7 | ||||
-rw-r--r-- | io.c | 7 |
2 files changed, 12 insertions, 2 deletions
@@ -1,3 +1,10 @@ +Thu Apr 28 06:06:56 2011 Nobuyoshi Nakada <nobu@ruby-lang.org> + + * io.c (rb_io_extract_modeenc, rb_f_backquote): set default text + mode. fixes #4619 + + * io.c (pipe_open): set universal newline decorator if needed. + Wed Apr 27 11:33:08 2011 NARUSE, Yui <naruse@ruby-lang.org> * enc/trans/emoji_iso2022_kddi.trans: ISO-2022-JP-KDDI doesn't have @@ -4496,7 +4496,7 @@ rb_io_extract_modeenc(VALUE *vmode_p, VALUE *vperm_p, VALUE opthash, rb_io_ext_int_to_encs(NULL, NULL, &enc, &enc2); if (NIL_P(vmode)) { - fmode = FMODE_READABLE; + fmode = FMODE_READABLE | DEFAULT_TEXTMODE; oflags = O_RDONLY; } else if (!NIL_P(intmode = rb_check_to_integer(vmode, "to_int"))) { @@ -5249,6 +5249,9 @@ pipe_open(struct rb_exec_arg *eargp, VALUE prog, const char *modestr, int fmode, if (convconfig) { fptr->encs = *convconfig; } + else if (NEED_NEWLINE_DECORATOR_ON_READ(fptr)) { + fptr->encs.ecflags |= ECONV_UNIVERSAL_NEWLINE_DECORATOR; + } fptr->pid = pid; if (0 <= write_fd) { @@ -7248,7 +7251,7 @@ rb_f_backquote(VALUE obj, VALUE str) rb_io_t *fptr; SafeStringValue(str); - port = pipe_open_s(str, "r", FMODE_READABLE, NULL); + port = pipe_open_s(str, "r", FMODE_READABLE|DEFAULT_TEXTMODE, NULL); if (NIL_P(port)) return rb_str_new(0,0); GetOpenFile(port, fptr); |