зеркало из https://github.com/github/ruby.git
* io.c (pipe_open): follow up changes in r35889.
* process.c (proc_spawn_n): now uses char ** instead of VALUE *. * process.c (rb_spawn_process): prog is now VALUE of String, not char *. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35896 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
436d819bf2
Коммит
859869e522
|
@ -1,3 +1,11 @@
|
|||
Mon Jun 4 10:42:04 2012 NAKAMURA Usaku <usa@ruby-lang.org>
|
||||
|
||||
* io.c (pipe_open): follow up changes in r35889.
|
||||
|
||||
* process.c (proc_spawn_n): now uses char ** instead of VALUE *.
|
||||
|
||||
* process.c (rb_spawn_process): prog is now VALUE of String, not char *.
|
||||
|
||||
Mon Jun 4 06:12:43 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* marshal.c (r_object0): remove old warning for _alloc.
|
||||
|
|
32
io.c
32
io.c
|
@ -5501,24 +5501,6 @@ pipe_open(struct rb_exec_arg *eargp, VALUE prog, const char *modestr, int fmode,
|
|||
cmd = StringValueCStr(prog);
|
||||
#endif
|
||||
|
||||
#if !defined(HAVE_FORK)
|
||||
if (!eargp) {
|
||||
/* fork : IO.popen("-") */
|
||||
argc = 0;
|
||||
argv = 0;
|
||||
}
|
||||
else if (eargp->argc) {
|
||||
/* no shell : IO.popen([prog, arg0], arg1, ...) */
|
||||
argc = eargp->argc;
|
||||
argv = eargp->argv;
|
||||
}
|
||||
else {
|
||||
/* with shell : IO.popen(prog) */
|
||||
argc = 0;
|
||||
argv = 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_FORK)
|
||||
arg.execp = eargp;
|
||||
arg.modef = fmode;
|
||||
|
@ -5599,18 +5581,8 @@ pipe_open(struct rb_exec_arg *eargp, VALUE prog, const char *modestr, int fmode,
|
|||
fd = arg.pair[1];
|
||||
}
|
||||
#elif defined(_WIN32)
|
||||
if (argc) {
|
||||
int i;
|
||||
|
||||
if (argc >= (int)(FIXNUM_MAX / sizeof(char *))) {
|
||||
rb_raise(rb_eArgError, "too many arguments");
|
||||
}
|
||||
argbuf = rb_str_tmp_new((argc+1) * sizeof(char *));
|
||||
args = (void *)RSTRING_PTR(argbuf);
|
||||
for (i = 0; i < argc; ++i) {
|
||||
args[i] = StringValueCStr(argv[i]);
|
||||
}
|
||||
args[i] = NULL;
|
||||
if (eargp && eargp->argv_str) {
|
||||
args = (char **)RSTRING_PTR(eargp->argv_str);
|
||||
}
|
||||
switch (fmode & (FMODE_READABLE|FMODE_WRITABLE)) {
|
||||
case FMODE_READABLE|FMODE_WRITABLE:
|
||||
|
|
19
process.c
19
process.c
|
@ -1253,30 +1253,21 @@ proc_spawn_v(char **argv, char *prog)
|
|||
#endif
|
||||
|
||||
static rb_pid_t
|
||||
proc_spawn_n(int argc, VALUE *argv, VALUE prog, VALUE options)
|
||||
proc_spawn_n(int argc, char **argv, VALUE prog, VALUE options)
|
||||
{
|
||||
char **args;
|
||||
int i;
|
||||
VALUE v;
|
||||
rb_pid_t pid = -1;
|
||||
|
||||
args = ALLOC_ARGV(argc + 1, v);
|
||||
for (i = 0; i < argc; i++) {
|
||||
args[i] = RSTRING_PTR(argv[i]);
|
||||
}
|
||||
args[i] = (char*) 0;
|
||||
if (args[0]) {
|
||||
if (argv[0]) {
|
||||
#if defined(_WIN32)
|
||||
DWORD flags = 0;
|
||||
if (RTEST(rb_ary_entry(options, EXEC_OPTION_NEW_PGROUP))) {
|
||||
flags = CREATE_NEW_PROCESS_GROUP;
|
||||
}
|
||||
pid = rb_w32_aspawn_flags(P_NOWAIT, prog ? RSTRING_PTR(prog) : 0, args, flags);
|
||||
pid = rb_w32_aspawn_flags(P_NOWAIT, prog ? RSTRING_PTR(prog) : 0, argv, flags);
|
||||
#else
|
||||
pid = proc_spawn_v(args, prog ? RSTRING_PTR(prog) : 0);
|
||||
pid = proc_spawn_v(argv, prog ? RSTRING_PTR(prog) : 0);
|
||||
#endif
|
||||
}
|
||||
ALLOCV_END(v);
|
||||
return pid;
|
||||
}
|
||||
|
||||
|
@ -3096,7 +3087,7 @@ rb_spawn_process(struct rb_exec_arg *earg, VALUE prog, char *errmsg, size_t errm
|
|||
|
||||
if (prog && !earg->use_shell) {
|
||||
char **argv = (char **)RSTRING_PTR(earg->argv_str);
|
||||
argv[0] = prog;
|
||||
argv[0] = RSTRING_PTR(prog);
|
||||
}
|
||||
# if defined HAVE_SPAWNV
|
||||
if (earg->use_shell) {
|
||||
|
|
Загрузка…
Ссылка в новой задаче