summaryrefslogtreecommitdiff
path: root/io.c
diff options
context:
space:
mode:
authorakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-04-09 12:44:35 (GMT)
committerakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-04-09 12:44:35 (GMT)
commitf6b1dd28c9b765c361e228276bbd2e4fcd13687b (patch)
tree1c114e54a231608bccc96d3e1fc511d05ee759e3 /io.c
parent99605583379b28502ba375bdfcd995ed19fc6754 (diff)
* internal.h (rb_execarg_parent_end): Declared.
* process.c: "spawn" opens files in the parent process. (check_exec_redirect): Add an placeholder for fd in parameters for fd_open. (check_exec_fds_1): Delete fd_open condition. (check_exec_fds): Don't call check_exec_fds_1 with fd_open. (rb_execarg_parent_start): Open files specified as "spawn" options and add "dup2" options. (rb_execarg_parent_end): New function to close opened fds. (run_exec_open): Removed. (rb_execarg_run_options): Don't call run_exec_open. (rb_spawn_internal): Call rb_execarg_parent_end. * io.c (pipe_open): Call rb_execarg_parent_end. * ext/pty/pty.c (establishShell): Call rb_execarg_parent_end. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50194 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'io.c')
-rw-r--r--io.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/io.c b/io.c
index 1743f61..56ba082 100644
--- a/io.c
+++ b/io.c
@@ -6000,6 +6000,7 @@ pipe_open(VALUE execarg_obj, const char *modestr, int fmode, convconfig_t *convc
if (0 <= arg.write_pair[1]) close(arg.write_pair[1]);
if (0 <= arg.pair[0]) close(arg.pair[0]);
if (0 <= arg.pair[1]) close(arg.pair[1]);
+ rb_execarg_parent_end(execarg_obj);
rb_jump_tag(state);
}
@@ -6025,6 +6026,7 @@ pipe_open(VALUE execarg_obj, const char *modestr, int fmode, convconfig_t *convc
if (eargp)
rb_execarg_run_options(sargp, NULL, NULL, 0);
# endif
+ rb_execarg_parent_end(execarg_obj);
}
else {
# if defined(HAVE_WORKING_FORK)
@@ -6083,8 +6085,10 @@ pipe_open(VALUE execarg_obj, const char *modestr, int fmode, convconfig_t *convc
rb_execarg_run_options(eargp, sargp, NULL, 0);
}
fp = popen(cmd, modestr);
- if (eargp)
+ if (eargp) {
+ rb_execarg_parent_end(execarg_obj);
rb_execarg_run_options(sargp, NULL, NULL, 0);
+ }
if (!fp) rb_sys_fail_path(prog);
fd = fileno(fp);
#endif