* process.c (rb_proc_exec_n): revert the function removed at r35889.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36028 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
akr 2012-06-10 21:31:49 +00:00
Родитель 35973f273c
Коммит 9ea35ccf30
3 изменённых файлов: 53 добавлений и 0 удалений

Просмотреть файл

@ -1,3 +1,7 @@
Mon Jun 11 06:31:33 2012 Tanaka Akira <akr@fsij.org>
* process.c (rb_proc_exec_n): revert the function removed at r35889.
Mon Jun 11 06:20:50 2012 NARUSE, Yui <naruse@ruby-lang.org>
* thread_pthread.c (rb_thread_create_timer_thread): assign return

Просмотреть файл

@ -607,6 +607,7 @@ struct rb_exec_arg {
VALUE envp_buf;
VALUE dup2_tmpbuf;
};
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);

Просмотреть файл

@ -1147,6 +1147,54 @@ proc_exec_cmd(const char *prog, VALUE argv_str, VALUE envp_str)
#endif
}
/* deprecated */
static int
proc_exec_v(char **argv, const char *prog)
{
char fbuf[MAXPATHLEN];
if (!prog)
prog = argv[0];
prog = dln_find_exe_r(prog, 0, fbuf, sizeof(fbuf));
if (!prog) {
errno = ENOENT;
return -1;
}
before_exec();
execv(prog, argv);
preserving_errno(try_with_sh(prog, argv, 0); after_exec());
return -1;
}
/* deprecated */
int
rb_proc_exec_n(int argc, VALUE *argv, const char *prog)
{
#define ARGV_COUNT(n) ((n)+1)
#define ARGV_SIZE(n) (sizeof(char*) * ARGV_COUNT(n))
#define ALLOC_ARGV(n, v) ALLOCV_N(char*, (v), ARGV_COUNT(n))
char **args;
int i;
int ret = -1;
VALUE v;
args = ALLOC_ARGV(argc+1, v);
for (i=0; i<argc; i++) {
args[i] = RSTRING_PTR(argv[i]);
}
args[i] = 0;
if (args[0]) {
ret = proc_exec_v(args, prog);
}
ALLOCV_END(v);
return ret;
#undef ARGV_COUNT
#undef ARGV_SIZE
#undef ALLOC_ARGV
}
/* This function should be async-signal-safe. Actually it is. */
static int
proc_exec_sh(const char *str, VALUE envp_str)