aboutsummaryrefslogtreecommitdiffstats
path: root/ext/pty/pty.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-09-02 21:14:51 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-09-02 21:14:51 +0000
commit185e9705abbb8c2f96e748a400b76db61e129902 (patch)
tree1223c8232d3d170e9c140c32ec3a43079673f307 /ext/pty/pty.c
parentd878c51357f6a0e72271b6d0299480711b70701a (diff)
downloadruby-185e9705abbb8c2f96e748a400b76db61e129902.tar.gz
* ext/pty/pty.c (chfunc): restore errno from SystemCallError and
propagate proper exception to the parent. [ruby-dev:41965] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29169 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/pty/pty.c')
-rw-r--r--ext/pty/pty.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/ext/pty/pty.c b/ext/pty/pty.c
index 51bf3a33a5..156e4563c3 100644
--- a/ext/pty/pty.c
+++ b/ext/pty/pty.c
@@ -162,6 +162,7 @@ chfunc(void *data, char *errbuf, size_t errbuf_len)
int slave = carg->slave;
int argc = carg->argc;
VALUE *argv = carg->argv;
+ VALUE exc;
struct exec_info arg;
int status;
@@ -221,7 +222,12 @@ chfunc(void *data, char *errbuf, size_t errbuf_len)
arg.argv = argv;
rb_protect(pty_exec, (VALUE)&arg, &status);
sleep(1);
- return -1;
+ errno = ENOENT; /* last resort */
+ exc = rb_errinfo();
+ if (!NIL_P(exc)) {
+ errno = NUM2INT(rb_attr_get(exc, rb_intern("errno")));
+ }
+ ERROR_EXIT(StringValueCStr(argv[0]));
#undef ERROR_EXIT
}