diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-06-08 02:26:39 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-06-08 02:26:39 +0000 |
commit | 182dc9d40d7e32ef3782ad333613933afdc308f9 (patch) | |
tree | d6c69383f66abcdcea89ae01f3338e2c714e5ccc | |
parent | bc81a19e99ab99d4a1d8e4cedce3fbf87c52bda4 (diff) | |
download | ruby-182dc9d40d7e32ef3782ad333613933afdc308f9.tar.gz |
process.c, ext/pty/pty.c: status on errors
* process.c (rb_fork_err): determine status on errors.
* ext/pty/pty.c (establishShell): reraise exception if something
raised during sleep.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35959 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | ChangeLog | 7 | ||||
-rw-r--r-- | ext/pty/pty.c | 1 | ||||
-rw-r--r-- | process.c | 5 |
3 files changed, 11 insertions, 2 deletions
@@ -1,4 +1,9 @@ -Fri Jun 8 11:25:51 2012 Nobuyoshi Nakada <nobu@ruby-lang.org> +Fri Jun 8 11:26:37 2012 Nobuyoshi Nakada <nobu@ruby-lang.org> + + * process.c (rb_fork_err): determine status on errors. + + * ext/pty/pty.c (establishShell): reraise exception if something + raised during sleep. * ext/pty/pty.c (establishShell): now needs status to protect from exceptions in rb_fork_err(). diff --git a/ext/pty/pty.c b/ext/pty/pty.c index be87c3701b..ee56d5862f 100644 --- a/ext/pty/pty.c +++ b/ext/pty/pty.c @@ -196,6 +196,7 @@ establishShell(int argc, VALUE *argv, struct pty_info *info, close(master); close(slave); errno = e; + if (status) rb_jump_tag(status); rb_sys_fail(errbuf[0] ? errbuf : "fork failed"); } @@ -2736,7 +2736,9 @@ chfunc_protect(VALUE arg) * process. * * If +status+ is given, protects from any exceptions and sets the - * jump status to it. + * jump status to it, and returns -1. If failed to fork new process + * but no exceptions occurred, sets 0 to it. Otherwise, if forked + * successfully, the value of +status+ is undetermined. * * In the child process, just returns 0 if +chfunc+ is +NULL+. * Otherwise +chfunc+ will be called with +charg+, and then the child @@ -2773,6 +2775,7 @@ rb_fork_err(int *status, int (*chfunc)(void*, char *, size_t), void *charg, VALU #ifdef FD_CLOEXEC if (chfunc) { + if (status) *status = 0; if (pipe_nocrash(ep, fds)) return -1; if (fcntl(ep[1], F_SETFD, FD_CLOEXEC)) { preserving_errno((close(ep[0]), close(ep[1]))); |