зеркало из https://github.com/github/ruby.git
* internal.h (rb_execarg): add new_pgroup_given and new_pgroup_flag
fields. * process.c (EXEC_OPTION_NEW_PGROUP): removed. (proc_spawn_cmd): take a struct rb_execarg argument. use the new fields. (rb_execarg_addopt): use the new fields. (rb_spawn_process): follow the proc_spawn_cmd change. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36202 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
345ecf3711
Коммит
f1734b4287
11
ChangeLog
11
ChangeLog
|
@ -1,3 +1,14 @@
|
|||
Sat Jun 23 23:19:31 2012 Tanaka Akira <akr@fsij.org>
|
||||
|
||||
* internal.h (rb_execarg): add new_pgroup_given and new_pgroup_flag
|
||||
fields.
|
||||
|
||||
* process.c (EXEC_OPTION_NEW_PGROUP): removed.
|
||||
(proc_spawn_cmd): take a struct rb_execarg argument.
|
||||
use the new fields.
|
||||
(rb_execarg_addopt): use the new fields.
|
||||
(rb_spawn_process): follow the proc_spawn_cmd change.
|
||||
|
||||
Sat Jun 23 20:26:36 2012 Tanaka Akira <akr@fsij.org>
|
||||
|
||||
* internal.h (rb_execarg): add fd_dup2, fd_close, fd_open,
|
||||
|
|
|
@ -183,6 +183,8 @@ struct rb_execarg {
|
|||
unsigned close_others_given : 1;
|
||||
unsigned close_others_do : 1;
|
||||
unsigned chdir_given : 1;
|
||||
unsigned new_pgroup_given : 1;
|
||||
unsigned new_pgroup_flag : 1;
|
||||
pid_t pgroup_pgid; /* asis(-1), new pgroup(0), specified pgroup (0<V). */
|
||||
VALUE rlimit_limits; /* Qfalse or [[rtype, softlim, hardlim], ...] */
|
||||
mode_t umask_mask;
|
||||
|
|
17
process.c
17
process.c
|
@ -1253,10 +1253,6 @@ rb_proc_exec(const char *str)
|
|||
return ret;
|
||||
}
|
||||
|
||||
enum {
|
||||
EXEC_OPTION_NEW_PGROUP
|
||||
};
|
||||
|
||||
static void
|
||||
mark_exec_arg(void *ptr)
|
||||
{
|
||||
|
@ -1345,14 +1341,15 @@ proc_spawn_cmd_internal(char **argv, char *prog)
|
|||
#endif
|
||||
|
||||
static rb_pid_t
|
||||
proc_spawn_cmd(char **argv, VALUE prog, VALUE options)
|
||||
proc_spawn_cmd(char **argv, VALUE prog, struct rb_execarg *eargp)
|
||||
{
|
||||
VALUE options = eargp->options;
|
||||
rb_pid_t pid = -1;
|
||||
|
||||
if (argv[0]) {
|
||||
#if defined(_WIN32)
|
||||
DWORD flags = 0;
|
||||
if (RTEST(rb_ary_entry(options, EXEC_OPTION_NEW_PGROUP))) {
|
||||
if (eargp->new_pgroup_given && eargp->new_pgroup_flag) {
|
||||
flags = CREATE_NEW_PROCESS_GROUP;
|
||||
}
|
||||
pid = rb_w32_aspawn_flags(P_NOWAIT, prog ? RSTRING_PTR(prog) : 0, argv, flags);
|
||||
|
@ -1579,11 +1576,11 @@ rb_execarg_addopt(VALUE execarg_obj, VALUE key, VALUE val)
|
|||
#endif
|
||||
#ifdef _WIN32
|
||||
if (id == rb_intern("new_pgroup")) {
|
||||
if (!NIL_P(rb_ary_entry(options, EXEC_OPTION_NEW_PGROUP))) {
|
||||
if (eargp->new_pgroup_given) {
|
||||
rb_raise(rb_eArgError, "new_pgroup option specified twice");
|
||||
}
|
||||
val = RTEST(val) ? Qtrue : Qfalse;
|
||||
rb_ary_store(options, EXEC_OPTION_NEW_PGROUP, val);
|
||||
eargp->new_pgroup_given = 1;
|
||||
eargp->new_pgroup_flag = RTEST(val) ? 1 : 0;
|
||||
}
|
||||
else
|
||||
#endif
|
||||
|
@ -3525,7 +3522,7 @@ rb_spawn_process(struct rb_execarg *eargp, char *errmsg, size_t errmsg_buflen)
|
|||
}
|
||||
else {
|
||||
char **argv = ARGVSTR2ARGV(eargp->invoke.cmd.argv_str);
|
||||
pid = proc_spawn_cmd(argv, prog, eargp->options);
|
||||
pid = proc_spawn_cmd(argv, prog, eargp);
|
||||
}
|
||||
# if defined(_WIN32)
|
||||
if (pid == -1)
|
||||
|
|
Загрузка…
Ссылка в новой задаче