diff options
author | nagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-08-11 19:13:38 +0000 |
---|---|---|
committer | nagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-08-11 19:13:38 +0000 |
commit | 395340fa30e1d0b92319c01c2b785d24e8c40294 (patch) | |
tree | 6135e3a50d21dd2f0a6b698abce73331af4598dd /io.c | |
parent | 8dc8bba42d63b5ada216f94b85f8dceb72e266a8 (diff) |
merge revision(s) 55090,55091: [Backport #12398]
io.c: conditionally used functions
* io.c (pipe_atexit): only used on Windows
* io.c (rb_execarg_fixup_v): wrapper only used fork or spawnv is
available.
* process.c (rb_execarg_commandline): build command line string
from argument vector in rb_execarg.
[ruby-core:75611] [Bug #12398]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_3@55870 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'io.c')
-rw-r--r-- | io.c | 15 |
1 files changed, 7 insertions, 8 deletions
@@ -5671,6 +5671,7 @@ pipe_del_fptr(rb_io_t *fptr) } } +#if defined (_WIN32) || defined(__CYGWIN__) static void pipe_atexit(void) { @@ -5683,6 +5684,7 @@ pipe_atexit(void) list = tmp; } } +#endif static void pipe_finalize(rb_io_t *fptr, int noraise) @@ -5868,12 +5870,16 @@ popen_exec(void *pp, char *errmsg, size_t errmsg_len) } #endif +#if defined(HAVE_WORKING_FORK) || defined(HAVE_SPAWNV) static VALUE rb_execarg_fixup_v(VALUE execarg_obj) { rb_execarg_parent_start(execarg_obj); return Qnil; } +#else +char *rb_execarg_commandline(const struct rb_execarg *eargp, VALUE *prog); +#endif static VALUE pipe_open(VALUE execarg_obj, const char *modestr, int fmode, convconfig_t *convconfig) @@ -5919,10 +5925,6 @@ pipe_open(VALUE execarg_obj, const char *modestr, int fmode, convconfig_t *convc int write_fd = -1; #if !defined(HAVE_WORKING_FORK) const char *cmd = 0; -#if !defined(HAVE_SPAWNV) - int argc; - VALUE *argv; -#endif if (prog) cmd = StringValueCStr(prog); @@ -6051,10 +6053,7 @@ pipe_open(VALUE execarg_obj, const char *modestr, int fmode, convconfig_t *convc fd = arg.pair[1]; } #else - if (argc) { - prog = rb_ary_join(rb_ary_new4(argc, argv), rb_str_new2(" ")); - cmd = StringValueCStr(prog); - } + cmd = rb_execarg_commandline(eargp, &prog); if (!NIL_P(execarg_obj)) { rb_execarg_parent_start(execarg_obj); rb_execarg_run_options(eargp, sargp, NULL, 0); |