summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-05-12 09:17:58 +0000
committerusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-05-12 09:17:58 +0000
commitad72d1d3a2952446b2808e137961353100f0d3ce (patch)
treecb0c2078ba754e023e3f025de7165a55f1a717d1
parent430cabfad89206e286f2950b392cdf8d37755082 (diff)
* 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
-rw-r--r--ChangeLog5
-rw-r--r--process.c19
2 files changed, 16 insertions, 8 deletions
diff --git a/ChangeLog b/ChangeLog
index 1791284..6315a4b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Mon May 12 18:16:44 2008 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * 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 <akr@fsij.org>
* gc.c (ruby_vm_xmalloc): increase malloc_increase only if malloc
diff --git a/process.c b/process.c
index 4607ede..bdba37b 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;