From f1734b4287e81ad281924c9acf89a754e43c6e2e Mon Sep 17 00:00:00 2001 From: akr Date: Sat, 23 Jun 2012 14:21:47 +0000 Subject: [PATCH] * 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 --- ChangeLog | 11 +++++++++++ internal.h | 2 ++ process.c | 17 +++++++---------- 3 files changed, 20 insertions(+), 10 deletions(-) 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)