diff --git a/ChangeLog b/ChangeLog index 9da88d05ac..e44fedde61 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +Sat Jun 23 23:19:31 2012 Tanaka Akira + + * 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 * internal.h (rb_execarg): add fd_dup2, fd_close, fd_open, diff --git a/internal.h b/internal.h index 674525daf0..cbcfe4ecf2 100644 --- a/internal.h +++ b/internal.h @@ -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 (0options; 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)