From 819619495ae880d03deee55b39b7381a38fb2b03 Mon Sep 17 00:00:00 2001 From: nobu Date: Tue, 7 Aug 2007 03:31:54 +0000 Subject: [PATCH] * io.c (pipe_open): fix for win32 platforms. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12894 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 4 ++++ io.c | 9 ++++----- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index b64b8b8d99..799dd81d62 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +Tue Aug 7 12:31:51 2007 Nobuyoshi Nakada + + * io.c (pipe_open): fix for win32 platforms. + Tue Aug 7 02:58:33 2007 Yukihiro Matsumoto * bignum.c (rb_big2str0): make Bignum#to_s even faster. a patch diff --git a/io.c b/io.c index fabad00da8..d39576c809 100644 --- a/io.c +++ b/io.c @@ -3061,7 +3061,7 @@ pipe_open(const char *cmd, int argc, VALUE *argv, const char *mode) struct popen_arg arg; #elif defined(_WIN32) int openmode = rb_io_mode_modenum(mode); - char *exename = NULL; + const char *exename = NULL; #endif FILE *fp = 0; int fd = -1; @@ -3135,9 +3135,8 @@ pipe_open(const char *cmd, int argc, VALUE *argv, const char *mode) args[i] = RSTRING_PTR(argv[i]); } args[i] = NULL; - cmd = ALLOCA_N(char, rb_w32_argv_size(args)); - rb_w32_join_argv(cmd, args); - exename = RSTRING_PTR(prog); + exename = cmd; + cmd = rb_w32_join_argv(ALLOCA_N(char, rb_w32_argv_size(args)), args); } while ((pid = rb_w32_pipe_exec(cmd, exename, openmode, &fd)) == -1) { /* exec failed */ @@ -3149,7 +3148,7 @@ pipe_open(const char *cmd, int argc, VALUE *argv, const char *mode) rb_thread_sleep(1); break; default: - rb_sys_fail(RSTRING_PTR(prog)); + rb_sys_fail(cmd); break; } }