summaryrefslogtreecommitdiff
path: root/process.c
diff options
context:
space:
mode:
authorakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-06-23 08:18:34 +0000
committerakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-06-23 08:18:34 +0000
commit26ecb6cbc4d6ebd3fcb7d8a1f829e2910ad26bdc (patch)
tree3f30a5b6be5d47761fa2b3b7a079b3412ada37e9 /process.c
parentf732c5046ed89b0ed669e97f36f5fa05b9a33b73 (diff)
* internal.h (rb_execarg): add env_modification field.
* process.c (EXEC_OPTION_ENV): removed. (mark_exec_arg): mark env_modification field. (rb_exec_fillarg): update the new field, instead of options array. (rb_execarg_fixup): use the new field. (save_env): ditto. (rb_execarg_run_options): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36197 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'process.c')
-rw-r--r--process.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/process.c b/process.c
index bf937dfa7a..61a0d01aa9 100644
--- a/process.c
+++ b/process.c
@@ -1254,7 +1254,6 @@ rb_proc_exec(const char *str)
}
enum {
- EXEC_OPTION_ENV,
EXEC_OPTION_DUP2,
EXEC_OPTION_CLOSE,
EXEC_OPTION_OPEN,
@@ -1280,6 +1279,7 @@ mark_exec_arg(void *ptr)
rb_gc_mark(eargp->envp_buf);
rb_gc_mark(eargp->dup2_tmpbuf);
rb_gc_mark(eargp->rlimit_limits);
+ rb_gc_mark(eargp->env_modification);
rb_gc_mark(eargp->chdir_dir);
}
@@ -1896,7 +1896,7 @@ rb_exec_fillarg(VALUE prog, int argc, VALUE *argv, VALUE env, VALUE opthash, VAL
}
if (!NIL_P(env)) {
env = rb_check_exec_env(env);
- rb_ary_store(options, EXEC_OPTION_ENV, env);
+ eargp->env_modification = env;
}
eargp->use_shell = argc == 0;
@@ -2128,8 +2128,8 @@ rb_execarg_fixup(VALUE execarg_obj)
}
unsetenv_others = eargp->unsetenv_others_given && eargp->unsetenv_others_do;
- envopts = rb_ary_entry(eargp->options, EXEC_OPTION_ENV);
- if (unsetenv_others || !NIL_P(envopts)) {
+ envopts = eargp->env_modification;
+ if (unsetenv_others || envopts != Qfalse) {
VALUE envtbl, envp_str, envp_buf;
char *p, *ep;
if (unsetenv_others) {
@@ -2705,13 +2705,13 @@ save_env(struct rb_execarg *sargp)
if (!sargp)
return;
soptions = sargp->options;
- if (NIL_P(rb_ary_entry(soptions, EXEC_OPTION_ENV))) {
+ if (sargp->env_modification == Qfalse) {
VALUE env = rb_const_get(rb_cObject, rb_intern("ENV"));
if (RTEST(env)) {
VALUE ary = hide_obj(rb_ary_new());
rb_block_call(env, rb_intern("each"), 0, 0, save_env_i,
(VALUE)ary);
- rb_ary_store(soptions, EXEC_OPTION_ENV, ary);
+ sargp->env_modification = ary;
}
rb_ary_store(soptions, EXEC_OPTION_UNSETENV_OTHERS, Qtrue);
}
@@ -2757,8 +2757,8 @@ rb_execarg_run_options(const struct rb_execarg *eargp, struct rb_execarg *sargp,
rb_env_clear();
}
- obj = rb_ary_entry(options, EXEC_OPTION_ENV);
- if (!NIL_P(obj)) {
+ obj = eargp->env_modification;
+ if (obj != Qfalse) {
long i;
save_env(sargp);
for (i = 0; i < RARRAY_LEN(obj); i++) {