mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* include/ruby/intern.h (rb_exec_arg_init): deprecated.
(rb_exec_arg_addopt): ditto. (rb_exec_arg_fixup): ditto. (rb_run_exec_options): ditto. (rb_run_exec_options_err): ditto. * internal.h (rb_execarg_init): declared. (rb_execarg_addopt): ditto. (rb_execarg_fixup): ditto. (rb_execarg_run_options): ditto. * process.c: call rb_execarg_addopt, rb_execarg_fixup, rb_execarg_run_options, rb_execarg_init. (rb_execarg_addopt): renamed from rb_exec_arg_addopt. (rb_exec_arg_addopt): stub to call rb_execarg_addopt. (rb_execarg_init): renamed from rb_exec_arg_init. (rb_exec_arg_init): stub to call rb_execarg_init. (rb_execarg_fixup): renamed from rb_exec_arg_fixup. (rb_exec_arg_fixup): stub to call rb_execarg_fixup. (rb_execarg_run_options): renamed from rb_run_exec_options_err. (rb_run_exec_options_err): stub to call rb_execarg_run_options. (rb_run_exec_options): call rb_execarg_run_options. * io.c: call rb_execarg_addopt, rb_execarg_fixup, rb_execarg_run_options, rb_execarg_init. * ext/pty/pty.c (establishShell): call rb_execarg_init and rb_execarg_fixup. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36039 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
0284e64922
commit
37a1355bf8
6 changed files with 93 additions and 34 deletions
31
ChangeLog
31
ChangeLog
|
@ -1,3 +1,34 @@
|
|||
Tue Jun 12 20:29:19 2012 Tanaka Akira <akr@fsij.org>
|
||||
|
||||
* include/ruby/intern.h (rb_exec_arg_init): deprecated.
|
||||
(rb_exec_arg_addopt): ditto.
|
||||
(rb_exec_arg_fixup): ditto.
|
||||
(rb_run_exec_options): ditto.
|
||||
(rb_run_exec_options_err): ditto.
|
||||
|
||||
* internal.h (rb_execarg_init): declared.
|
||||
(rb_execarg_addopt): ditto.
|
||||
(rb_execarg_fixup): ditto.
|
||||
(rb_execarg_run_options): ditto.
|
||||
|
||||
* process.c: call rb_execarg_addopt, rb_execarg_fixup,
|
||||
rb_execarg_run_options, rb_execarg_init.
|
||||
(rb_execarg_addopt): renamed from rb_exec_arg_addopt.
|
||||
(rb_exec_arg_addopt): stub to call rb_execarg_addopt.
|
||||
(rb_execarg_init): renamed from rb_exec_arg_init.
|
||||
(rb_exec_arg_init): stub to call rb_execarg_init.
|
||||
(rb_execarg_fixup): renamed from rb_exec_arg_fixup.
|
||||
(rb_exec_arg_fixup): stub to call rb_execarg_fixup.
|
||||
(rb_execarg_run_options): renamed from rb_run_exec_options_err.
|
||||
(rb_run_exec_options_err): stub to call rb_execarg_run_options.
|
||||
(rb_run_exec_options): call rb_execarg_run_options.
|
||||
|
||||
* io.c: call rb_execarg_addopt, rb_execarg_fixup,
|
||||
rb_execarg_run_options, rb_execarg_init.
|
||||
|
||||
* ext/pty/pty.c (establishShell): call rb_execarg_init and
|
||||
rb_execarg_fixup.
|
||||
|
||||
Tue Jun 12 18:39:59 2012 URABE Shyouhei <shyouhei@ruby-lang.org>
|
||||
|
||||
* configure.in: enable strict ANSI mode by default in case of GCC,
|
||||
|
|
|
@ -176,8 +176,8 @@ establishShell(int argc, VALUE *argv, struct pty_info *info,
|
|||
argv = &v;
|
||||
}
|
||||
|
||||
rb_exec_arg_init(argc, argv, 1, &carg.earg);
|
||||
rb_exec_arg_fixup(&carg.earg);
|
||||
rb_execarg_init(argc, argv, 1, &carg.earg);
|
||||
rb_execarg_fixup(&carg.earg);
|
||||
|
||||
getDevice(&master, &slave, SlaveName, 0);
|
||||
|
||||
|
|
|
@ -609,11 +609,11 @@ struct rb_exec_arg {
|
|||
};
|
||||
DEPRECATED(int rb_proc_exec_n(int, VALUE*, const char*));
|
||||
int rb_proc_exec(const char*);
|
||||
VALUE rb_exec_arg_init(int argc, VALUE *argv, int accept_shell, struct rb_exec_arg *e);
|
||||
int rb_exec_arg_addopt(struct rb_exec_arg *e, VALUE key, VALUE val);
|
||||
void rb_exec_arg_fixup(struct rb_exec_arg *e);
|
||||
int rb_run_exec_options(const struct rb_exec_arg *e, struct rb_exec_arg *s);
|
||||
int rb_run_exec_options_err(const struct rb_exec_arg *e, struct rb_exec_arg *s, char*, size_t);
|
||||
DEPRECATED(VALUE rb_exec_arg_init(int argc, VALUE *argv, int accept_shell, struct rb_exec_arg *e));
|
||||
DEPRECATED(int rb_exec_arg_addopt(struct rb_exec_arg *e, VALUE key, VALUE val));
|
||||
DEPRECATED(void rb_exec_arg_fixup(struct rb_exec_arg *e));
|
||||
DEPRECATED(int rb_run_exec_options(const struct rb_exec_arg *e, struct rb_exec_arg *s));
|
||||
DEPRECATED(int rb_run_exec_options_err(const struct rb_exec_arg *e, struct rb_exec_arg *s, char*, size_t));
|
||||
DEPRECATED(int rb_exec(const struct rb_exec_arg*));
|
||||
DEPRECATED(int rb_exec_err(const struct rb_exec_arg*, char*, size_t));
|
||||
DEPRECATED(rb_pid_t rb_fork(int*, int (*)(void*), void*, VALUE));
|
||||
|
|
|
@ -266,6 +266,10 @@ void rb_maygvl_fd_fix_cloexec(int fd);
|
|||
/* process.c */
|
||||
int rb_exec_async_signal_safe(const struct rb_exec_arg *e, char *errmsg, size_t errmsg_buflen);
|
||||
rb_pid_t rb_fork_async_signal_safe(int *status, int (*chfunc)(void*, char *, size_t), void *charg, VALUE fds, char *errmsg, size_t errmsg_buflen);
|
||||
VALUE rb_execarg_init(int argc, VALUE *argv, int accept_shell, struct rb_exec_arg *e);
|
||||
int rb_execarg_addopt(struct rb_exec_arg *e, VALUE key, VALUE val);
|
||||
void rb_execarg_fixup(struct rb_exec_arg *e);
|
||||
int rb_execarg_run_options(const struct rb_exec_arg *e, struct rb_exec_arg *s, char* errmsg, size_t errmsg_buflen);
|
||||
|
||||
#if defined __GNUC__ && __GNUC__ >= 4
|
||||
#pragma GCC visibility pop
|
||||
|
|
36
io.c
36
io.c
|
@ -5517,27 +5517,27 @@ pipe_open(struct rb_exec_arg *eargp, const char *modestr, int fmode, convconfig_
|
|||
rb_sys_fail_str(prog);
|
||||
}
|
||||
if (eargp) {
|
||||
rb_exec_arg_addopt(eargp, INT2FIX(0), INT2FIX(arg.write_pair[0]));
|
||||
rb_exec_arg_addopt(eargp, INT2FIX(1), INT2FIX(arg.pair[1]));
|
||||
rb_execarg_addopt(eargp, INT2FIX(0), INT2FIX(arg.write_pair[0]));
|
||||
rb_execarg_addopt(eargp, INT2FIX(1), INT2FIX(arg.pair[1]));
|
||||
}
|
||||
break;
|
||||
case FMODE_READABLE:
|
||||
if (rb_pipe(arg.pair) < 0)
|
||||
rb_sys_fail_str(prog);
|
||||
if (eargp)
|
||||
rb_exec_arg_addopt(eargp, INT2FIX(1), INT2FIX(arg.pair[1]));
|
||||
rb_execarg_addopt(eargp, INT2FIX(1), INT2FIX(arg.pair[1]));
|
||||
break;
|
||||
case FMODE_WRITABLE:
|
||||
if (rb_pipe(arg.pair) < 0)
|
||||
rb_sys_fail_str(prog);
|
||||
if (eargp)
|
||||
rb_exec_arg_addopt(eargp, INT2FIX(0), INT2FIX(arg.pair[0]));
|
||||
rb_execarg_addopt(eargp, INT2FIX(0), INT2FIX(arg.pair[0]));
|
||||
break;
|
||||
default:
|
||||
rb_sys_fail_str(prog);
|
||||
}
|
||||
if (eargp) {
|
||||
rb_exec_arg_fixup(arg.execp);
|
||||
rb_execarg_fixup(arg.execp);
|
||||
pid = rb_fork_async_signal_safe(&status, popen_exec, &arg, arg.execp->redirect_fds, errmsg, sizeof(errmsg));
|
||||
}
|
||||
else {
|
||||
|
@ -5595,28 +5595,28 @@ pipe_open(struct rb_exec_arg *eargp, const char *modestr, int fmode, convconfig_
|
|||
rb_sys_fail_str(prog);
|
||||
}
|
||||
if (eargp) {
|
||||
rb_exec_arg_addopt(eargp, INT2FIX(0), INT2FIX(write_pair[0]));
|
||||
rb_exec_arg_addopt(eargp, INT2FIX(1), INT2FIX(pair[1]));
|
||||
rb_execarg_addopt(eargp, INT2FIX(0), INT2FIX(write_pair[0]));
|
||||
rb_execarg_addopt(eargp, INT2FIX(1), INT2FIX(pair[1]));
|
||||
}
|
||||
break;
|
||||
case FMODE_READABLE:
|
||||
if (rb_pipe(pair) < 0)
|
||||
rb_sys_fail_str(prog);
|
||||
if (eargp)
|
||||
rb_exec_arg_addopt(eargp, INT2FIX(1), INT2FIX(pair[1]));
|
||||
rb_execarg_addopt(eargp, INT2FIX(1), INT2FIX(pair[1]));
|
||||
break;
|
||||
case FMODE_WRITABLE:
|
||||
if (rb_pipe(pair) < 0)
|
||||
rb_sys_fail_str(prog);
|
||||
if (eargp)
|
||||
rb_exec_arg_addopt(eargp, INT2FIX(0), INT2FIX(pair[0]));
|
||||
rb_execarg_addopt(eargp, INT2FIX(0), INT2FIX(pair[0]));
|
||||
break;
|
||||
default:
|
||||
rb_sys_fail_str(prog);
|
||||
}
|
||||
if (eargp) {
|
||||
rb_exec_arg_fixup(eargp);
|
||||
rb_run_exec_options(eargp, &sarg);
|
||||
rb_execarg_fixup(eargp);
|
||||
rb_execarg_run_options(eargp, &sarg, NULL, 0);
|
||||
}
|
||||
while ((pid = (args ?
|
||||
rb_w32_aspawn(P_NOWAIT, cmd, args) :
|
||||
|
@ -5633,7 +5633,7 @@ pipe_open(struct rb_exec_arg *eargp, const char *modestr, int fmode, convconfig_
|
|||
{
|
||||
int e = errno;
|
||||
if (eargp)
|
||||
rb_run_exec_options(&sarg, NULL);
|
||||
rb_execarg_run_options(&sarg, NULL, NULL, 0);
|
||||
close(pair[0]);
|
||||
close(pair[1]);
|
||||
if ((fmode & (FMODE_READABLE|FMODE_WRITABLE)) == (FMODE_READABLE|FMODE_WRITABLE)) {
|
||||
|
@ -5650,7 +5650,7 @@ pipe_open(struct rb_exec_arg *eargp, const char *modestr, int fmode, convconfig_
|
|||
RB_GC_GUARD(argbuf);
|
||||
|
||||
if (eargp)
|
||||
rb_run_exec_options(&sarg, NULL);
|
||||
rb_execarg_run_options(&sarg, NULL, NULL, 0);
|
||||
if ((fmode & FMODE_READABLE) && (fmode & FMODE_WRITABLE)) {
|
||||
close(pair[1]);
|
||||
fd = pair[0];
|
||||
|
@ -5671,12 +5671,12 @@ pipe_open(struct rb_exec_arg *eargp, const char *modestr, int fmode, convconfig_
|
|||
cmd = StringValueCStr(prog);
|
||||
}
|
||||
if (eargp) {
|
||||
rb_exec_arg_fixup(eargp);
|
||||
rb_run_exec_options(eargp, &sarg);
|
||||
rb_execarg_fixup(eargp);
|
||||
rb_execarg_run_options(eargp, &sarg, NULL, 0);
|
||||
}
|
||||
fp = popen(cmd, modestr);
|
||||
if (eargp)
|
||||
rb_run_exec_options(&sarg, NULL);
|
||||
rb_execarg_run_options(&sarg, NULL, NULL, 0);
|
||||
if (!fp) rb_sys_fail_path(prog);
|
||||
fd = fileno(fp);
|
||||
#endif
|
||||
|
@ -5727,7 +5727,7 @@ static VALUE
|
|||
pipe_open_v(int argc, VALUE *argv, const char *modestr, int fmode, convconfig_t *convconfig)
|
||||
{
|
||||
struct rb_exec_arg earg;
|
||||
rb_exec_arg_init(argc, argv, FALSE, &earg);
|
||||
rb_execarg_init(argc, argv, FALSE, &earg);
|
||||
return pipe_open(&earg, modestr, fmode, convconfig);
|
||||
}
|
||||
|
||||
|
@ -5747,7 +5747,7 @@ pipe_open_s(VALUE prog, const char *modestr, int fmode, convconfig_t *convconfig
|
|||
return pipe_open(NULL, modestr, fmode, convconfig);
|
||||
}
|
||||
|
||||
rb_exec_arg_init(argc, argv, TRUE, &earg);
|
||||
rb_execarg_init(argc, argv, TRUE, &earg);
|
||||
return pipe_open(&earg, modestr, fmode, convconfig);
|
||||
}
|
||||
|
||||
|
|
42
process.c
42
process.c
|
@ -1503,7 +1503,7 @@ static int rlimit_type_by_lname(const char *name);
|
|||
#endif
|
||||
|
||||
int
|
||||
rb_exec_arg_addopt(struct rb_exec_arg *e, VALUE key, VALUE val)
|
||||
rb_execarg_addopt(struct rb_exec_arg *e, VALUE key, VALUE val)
|
||||
{
|
||||
VALUE options = e->options;
|
||||
ID id;
|
||||
|
@ -1636,13 +1636,19 @@ redirect:
|
|||
return ST_CONTINUE;
|
||||
}
|
||||
|
||||
int
|
||||
rb_exec_arg_addopt(struct rb_exec_arg *e, VALUE key, VALUE val)
|
||||
{
|
||||
return rb_execarg_addopt(e, key, val);
|
||||
}
|
||||
|
||||
static int
|
||||
check_exec_options_i(st_data_t st_key, st_data_t st_val, st_data_t arg)
|
||||
{
|
||||
VALUE key = (VALUE)st_key;
|
||||
VALUE val = (VALUE)st_val;
|
||||
struct rb_exec_arg *e = (struct rb_exec_arg *)arg;
|
||||
return rb_exec_arg_addopt(e, key, val);
|
||||
return rb_execarg_addopt(e, key, val);
|
||||
}
|
||||
|
||||
static VALUE
|
||||
|
@ -1942,7 +1948,7 @@ rb_exec_fillarg(VALUE prog, int argc, VALUE *argv, VALUE env, VALUE opthash, str
|
|||
}
|
||||
|
||||
VALUE
|
||||
rb_exec_arg_init(int argc, VALUE *argv, int accept_shell, struct rb_exec_arg *e)
|
||||
rb_execarg_init(int argc, VALUE *argv, int accept_shell, struct rb_exec_arg *e)
|
||||
{
|
||||
VALUE prog;
|
||||
VALUE env = Qnil, opthash = Qnil;
|
||||
|
@ -1951,6 +1957,12 @@ rb_exec_arg_init(int argc, VALUE *argv, int accept_shell, struct rb_exec_arg *e)
|
|||
return e->use_shell ? e->invoke.sh.shell_script : e->invoke.cmd.command_name;
|
||||
}
|
||||
|
||||
VALUE
|
||||
rb_exec_arg_init(int argc, VALUE *argv, int accept_shell, struct rb_exec_arg *e)
|
||||
{
|
||||
return rb_execarg_init(argc, argv, accept_shell, e);
|
||||
}
|
||||
|
||||
static int
|
||||
fill_envp_buf_i(st_data_t st_key, st_data_t st_val, st_data_t arg)
|
||||
{
|
||||
|
@ -1970,7 +1982,7 @@ 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_exec_arg_fixup(struct rb_exec_arg *e)
|
||||
rb_execarg_fixup(struct rb_exec_arg *e)
|
||||
{
|
||||
VALUE unsetenv_others, envopts;
|
||||
VALUE ary;
|
||||
|
@ -2040,11 +2052,17 @@ rb_exec_arg_fixup(struct rb_exec_arg *e)
|
|||
}
|
||||
}
|
||||
|
||||
void
|
||||
rb_exec_arg_fixup(struct rb_exec_arg *e)
|
||||
{
|
||||
return rb_execarg_fixup(e);
|
||||
}
|
||||
|
||||
static void
|
||||
rb_exec_arg_prepare(struct rb_exec_arg *earg, int argc, VALUE *argv)
|
||||
{
|
||||
rb_exec_arg_init(argc, argv, TRUE, earg);
|
||||
rb_exec_arg_fixup(earg);
|
||||
rb_execarg_init(argc, argv, TRUE, earg);
|
||||
rb_execarg_fixup(earg);
|
||||
}
|
||||
|
||||
static int rb_exec_without_timer_thread(const struct rb_exec_arg *e, char *errmsg, size_t errmsg_buflen);
|
||||
|
@ -2556,7 +2574,7 @@ save_env(VALUE save)
|
|||
|
||||
/* This function should be async-signal-safe when _s_ is not NULL. Hopefully it is. */
|
||||
int
|
||||
rb_run_exec_options_err(const struct rb_exec_arg *e, struct rb_exec_arg *s, char *errmsg, size_t errmsg_buflen)
|
||||
rb_execarg_run_options(const struct rb_exec_arg *e, struct rb_exec_arg *s, char *errmsg, size_t errmsg_buflen)
|
||||
{
|
||||
VALUE options = e->options;
|
||||
VALUE soptions = Qnil;
|
||||
|
@ -2681,10 +2699,16 @@ rb_run_exec_options_err(const struct rb_exec_arg *e, struct rb_exec_arg *s, char
|
|||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
rb_run_exec_options_err(const struct rb_exec_arg *e, struct rb_exec_arg *s, char *errmsg, size_t errmsg_buflen)
|
||||
{
|
||||
return rb_execarg_run_options(e, s, errmsg, errmsg_buflen);
|
||||
}
|
||||
|
||||
int
|
||||
rb_run_exec_options(const struct rb_exec_arg *e, struct rb_exec_arg *s)
|
||||
{
|
||||
return rb_run_exec_options_err(e, s, NULL, 0);
|
||||
return rb_execarg_run_options(e, s, NULL, 0);
|
||||
}
|
||||
|
||||
/* This function should be async-signal-safe. Hopefully it is. */
|
||||
|
@ -2699,7 +2723,7 @@ rb_exec_async_signal_safe(const struct rb_exec_arg *e, char *errmsg, size_t errm
|
|||
|
||||
before_exec_async_signal_safe(); /* async-signal-safe */
|
||||
|
||||
if (rb_run_exec_options_err(e, sargp, errmsg, errmsg_buflen) < 0) { /* hopefully async-signal-safe */
|
||||
if (rb_execarg_run_options(e, sargp, errmsg, errmsg_buflen) < 0) { /* hopefully async-signal-safe */
|
||||
goto failure;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue