Revision: 3917 http://trac.macosforge.org/projects/ruby/changeset/3917 Author: martinlagardette@apple.com Date: 2010-04-08 11:43:26 -0700 (Thu, 08 Apr 2010) Log Message: ----------- Fixes backquote operator Only waitpid after reading output. Fixes installation of the sqlite gem. Modified Paths: -------------- MacRuby/trunk/io.c Modified: MacRuby/trunk/io.c =================================================================== --- MacRuby/trunk/io.c 2010-04-07 21:19:32 UTC (rev 3916) +++ MacRuby/trunk/io.c 2010-04-08 18:43:26 UTC (rev 3917) @@ -3344,7 +3344,9 @@ VALUE io = rb_io_s_popen(rb_cIO, 0, 1, &str); rb_io_t *io_s = ExtractIOStruct(io); - // Wait that the process is finished before reading stuff. + VALUE outbuf = rb_bstr_new(); + rb_io_read_all(ExtractIOStruct(io), outbuf); + assert(io_s->pid != -1); int status; if (waitpid(io_s->pid, &status, 0) != -1) { @@ -3352,9 +3354,8 @@ io_s->pid = -1; } - VALUE outbuf = rb_bstr_new(); - rb_io_read_all(ExtractIOStruct(io), outbuf); rb_io_close(io); + rb_str_force_encoding(outbuf, rb_encodings[ENCODING_UTF8]); return outbuf; }