From ad72d1d3a2952446b2808e137961353100f0d3ce Mon Sep 17 00:00:00 2001 From: usa Date: Mon, 12 May 2008 09:17:58 +0000 Subject: [PATCH] * process.c (rb_spawn_internal): need to call run_exec_options() before spawn if the platform doesn't have fork. [ruby-dev:34647] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16389 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 5 +++++ process.c | 19 +++++++++++-------- 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/ChangeLog b/ChangeLog index 1791284291..6315a4b037 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Mon May 12 18:16:44 2008 NAKAMURA Usaku + + * process.c (rb_spawn_internal): need to call run_exec_options() before + spawn if the platform doesn't have fork. [ruby-dev:34647] + Mon May 12 15:20:02 2008 Tanaka Akira * gc.c (ruby_vm_xmalloc): increase malloc_increase only if malloc diff --git a/process.c b/process.c index 4607edeedf..bdba37b3ab 100644 --- a/process.c +++ b/process.c @@ -2565,26 +2565,29 @@ rb_spawn_internal(int argc, VALUE *argv, int default_close_others) #if defined HAVE_FORK status = rb_fork(&status, rb_exec_atfork, &earg, earg.redirect_fds); if (prog && earg.argc) earg.argv[0] = prog; -#elif defined HAVE_SPAWNV +#else + if (run_exec_options(&earg) < 0) { + return -1; + } + argc = earg.argc; argv = earg.argv; + if (prog && argc) argv[0] = prog; +# if defined HAVE_SPAWNV if (!argc) { status = proc_spawn(RSTRING_PTR(prog)); } else { status = proc_spawn_n(argc, argv, prog); } - if (prog && argc) argv[0] = prog; -#else - argc = earg.argc; - argv = earg.argv; - if (prog && argc) argv[0] = prog; +# else if (argc) prog = rb_ary_join(rb_ary_new4(argc, argv), rb_str_new2(" ")); status = system(StringValuePtr(prog)); -# if defined(__human68k__) || defined(__DJGPP__) +# if defined(__human68k__) || defined(__DJGPP__) rb_last_status_set(status == -1 ? 127 : status, 0); -# else +# else rb_last_status_set((status & 0xff) << 8, 0); +# endif # endif #endif return status;