1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* process.c (rb_execarg_fixup): take a VALUE argument instead of

struct rb_execarg.

* internal.h (rb_execarg_fixup): follow the definition change.

* io.c (pipe_open): follow rb_execarg_fixup change.

* ext/pty/pty.c (establishShell): ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36157 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
akr 2012-06-20 21:25:20 +00:00
parent 06feb7b057
commit d73d3a743b
5 changed files with 33 additions and 24 deletions

View file

@ -1,3 +1,14 @@
Thu Jun 21 06:21:54 2012 Tanaka Akira <akr@fsij.org>
* process.c (rb_execarg_fixup): take a VALUE argument instead of
struct rb_execarg.
* internal.h (rb_execarg_fixup): follow the definition change.
* io.c (pipe_open): follow rb_execarg_fixup change.
* ext/pty/pty.c (establishShell): ditto.
Wed Jun 20 21:25:37 2012 Tanaka Akira <akr@fsij.org>
* internal.h (struct rb_execarg): add umask_given and umask_mask

View file

@ -179,7 +179,7 @@ establishShell(int argc, VALUE *argv, struct pty_info *info,
carg.execarg_obj = rb_execarg_new(argc, argv, 1);
carg.earg = rb_execarg_get(carg.execarg_obj);
rb_execarg_fixup(carg.earg);
rb_execarg_fixup(carg.execarg_obj);
getDevice(&master, &slave, SlaveName, 0);

View file

@ -292,7 +292,7 @@ VALUE rb_execarg_new(int argc, VALUE *argv, int accept_shell);
struct rb_execarg *rb_execarg_get(VALUE execarg_obj); /* dangerous. needs GC guard. */
VALUE rb_execarg_init(int argc, VALUE *argv, int accept_shell, struct rb_execarg *e);
int rb_execarg_addopt(struct rb_execarg *e, VALUE key, VALUE val);
void rb_execarg_fixup(struct rb_execarg *e);
void rb_execarg_fixup(VALUE execarg_obj);
int rb_execarg_run_options(const struct rb_execarg *e, struct rb_execarg *s, char* errmsg, size_t errmsg_buflen);
#if defined __GNUC__ && __GNUC__ >= 4

23
io.c
View file

@ -5342,6 +5342,7 @@ rb_pipe(int *pipes)
#ifdef HAVE_FORK
struct popen_arg {
VALUE execarg_obj;
struct rb_execarg *execp;
int modef;
int pair[2];
@ -5466,8 +5467,9 @@ popen_exec(void *pp, char *errmsg, size_t errmsg_len)
#endif
static VALUE
pipe_open(struct rb_execarg *eargp, const char *modestr, int fmode, convconfig_t *convconfig)
pipe_open(VALUE execarg_obj, const char *modestr, int fmode, convconfig_t *convconfig)
{
struct rb_execarg *eargp = NIL_P(execarg_obj) ? NULL : rb_execarg_get(execarg_obj);
VALUE prog = eargp ? (eargp->use_shell ? eargp->invoke.sh.shell_script : eargp->invoke.cmd.command_name) : Qfalse ;
rb_pid_t pid = 0;
rb_io_t *fptr;
@ -5501,6 +5503,7 @@ pipe_open(struct rb_execarg *eargp, const char *modestr, int fmode, convconfig_t
#endif
#if defined(HAVE_FORK)
arg.execarg_obj = execarg_obj;
arg.execp = eargp;
arg.modef = fmode;
arg.pair[0] = arg.pair[1] = -1;
@ -5536,8 +5539,8 @@ pipe_open(struct rb_execarg *eargp, const char *modestr, int fmode, convconfig_t
default:
rb_sys_fail_str(prog);
}
if (eargp) {
rb_execarg_fixup(arg.execp);
if (!NIL_P(execarg_obj)) {
rb_execarg_fixup(execarg_obj);
pid = rb_fork_async_signal_safe(&status, popen_exec, &arg, arg.execp->redirect_fds, errmsg, sizeof(errmsg));
}
else {
@ -5614,8 +5617,8 @@ pipe_open(struct rb_execarg *eargp, const char *modestr, int fmode, convconfig_t
default:
rb_sys_fail_str(prog);
}
if (eargp) {
rb_execarg_fixup(eargp);
if (!NIL_P(execarg_obj)) {
rb_execarg_fixup(execarg_obj);
rb_execarg_run_options(eargp, &sarg, NULL, 0);
}
while ((pid = (args ?
@ -5670,8 +5673,8 @@ pipe_open(struct rb_execarg *eargp, const char *modestr, int fmode, convconfig_t
prog = rb_ary_join(rb_ary_new4(argc, argv), rb_str_new2(" "));
cmd = StringValueCStr(prog);
}
if (eargp) {
rb_execarg_fixup(eargp);
if (!NIL_P(execarg_obj)) {
rb_execarg_fixup(execarg_obj);
rb_execarg_run_options(eargp, &sarg, NULL, 0);
}
fp = popen(cmd, modestr);
@ -5730,7 +5733,7 @@ pipe_open_v(int argc, VALUE *argv, const char *modestr, int fmode, convconfig_t
struct rb_execarg *earg;
execarg_obj = rb_execarg_new(argc, argv, FALSE);
earg = rb_execarg_get(execarg_obj);
ret = pipe_open(earg, modestr, fmode, convconfig);
ret = pipe_open(execarg_obj, modestr, fmode, convconfig);
RB_GC_GUARD(execarg_obj);
return ret;
}
@ -5749,12 +5752,12 @@ pipe_open_s(VALUE prog, const char *modestr, int fmode, convconfig_t *convconfig
rb_raise(rb_eNotImpError,
"fork() function is unimplemented on this machine");
#endif
return pipe_open(NULL, modestr, fmode, convconfig);
return pipe_open(Qnil, modestr, fmode, convconfig);
}
execarg_obj = rb_execarg_new(argc, argv, TRUE);
earg = rb_execarg_get(execarg_obj);
ret = pipe_open(earg, modestr, fmode, convconfig);
ret = pipe_open(execarg_obj, modestr, fmode, convconfig);
RB_GC_GUARD(execarg_obj);
return ret;
}

View file

@ -2105,8 +2105,9 @@ fill_envp_buf_i(st_data_t st_key, st_data_t st_val, st_data_t arg)
static long run_exec_dup2_tmpbuf_size(long n);
void
rb_execarg_fixup(struct rb_execarg *e)
rb_execarg_fixup(VALUE execarg_obj)
{
struct rb_execarg *e = rb_execarg_get(execarg_obj);
VALUE unsetenv_others, envopts;
VALUE ary;
@ -2173,19 +2174,13 @@ rb_execarg_fixup(struct rb_execarg *e)
}
*/
}
RB_GC_GUARD(execarg_obj);
}
void
rb_exec_arg_fixup(struct rb_exec_arg *e)
{
rb_execarg_fixup(rb_execarg_get(e->execarg_obj));
}
static void
rb_exec_arg_prepare(struct rb_execarg *earg, int argc, VALUE *argv)
{
rb_execarg_init(argc, argv, TRUE, earg);
rb_execarg_fixup(earg);
rb_execarg_fixup(e->execarg_obj);
}
static int rb_exec_without_timer_thread(const struct rb_execarg *e, char *errmsg, size_t errmsg_buflen);
@ -2251,7 +2246,7 @@ rb_f_exec(int argc, VALUE *argv)
execarg_obj = rb_execarg_new(argc, argv, TRUE);
earg = rb_execarg_get(execarg_obj);
rb_execarg_fixup(earg);
rb_execarg_fixup(execarg_obj);
fail_str = earg->use_shell ? earg->invoke.sh.shell_script : earg->invoke.cmd.command_name;
#ifdef __MacOS_X__
@ -3543,7 +3538,7 @@ rb_spawn_internal(int argc, VALUE *argv, char *errmsg, size_t errmsg_buflen)
execarg_obj = rb_execarg_new(argc, argv, TRUE);
earg = rb_execarg_get(execarg_obj);
rb_execarg_fixup(earg);
rb_execarg_fixup(execarg_obj);
ret = rb_spawn_process(earg, errmsg, errmsg_buflen);
RB_GC_GUARD(execarg_obj);
return ret;
@ -3882,7 +3877,7 @@ rb_f_spawn(int argc, VALUE *argv)
execarg_obj = rb_execarg_new(argc, argv, TRUE);
earg = rb_execarg_get(execarg_obj);
rb_execarg_fixup(earg);
rb_execarg_fixup(execarg_obj);
fail_str = earg->use_shell ? earg->invoke.sh.shell_script : earg->invoke.cmd.command_name;
pid = rb_spawn_process(earg, errmsg, sizeof(errmsg));