* 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
This commit is contained in:
parent
d878c51357
commit
185e9705ab
@ -1,3 +1,8 @@
|
|||||||
|
Fri Sep 3 06:14:40 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||||
|
|
||||||
|
* ext/pty/pty.c (chfunc): restore errno from SystemCallError and
|
||||||
|
propagate proper exception to the parent. [ruby-dev:41965]
|
||||||
|
|
||||||
Thu Sep 2 22:10:38 2010 Tanaka Akira <akr@fsij.org>
|
Thu Sep 2 22:10:38 2010 Tanaka Akira <akr@fsij.org>
|
||||||
|
|
||||||
* ext/pathname/pathname.c (path_file_p): Pathname#file?
|
* ext/pathname/pathname.c (path_file_p): Pathname#file?
|
||||||
|
@ -162,6 +162,7 @@ chfunc(void *data, char *errbuf, size_t errbuf_len)
|
|||||||
int slave = carg->slave;
|
int slave = carg->slave;
|
||||||
int argc = carg->argc;
|
int argc = carg->argc;
|
||||||
VALUE *argv = carg->argv;
|
VALUE *argv = carg->argv;
|
||||||
|
VALUE exc;
|
||||||
|
|
||||||
struct exec_info arg;
|
struct exec_info arg;
|
||||||
int status;
|
int status;
|
||||||
@ -221,7 +222,12 @@ chfunc(void *data, char *errbuf, size_t errbuf_len)
|
|||||||
arg.argv = argv;
|
arg.argv = argv;
|
||||||
rb_protect(pty_exec, (VALUE)&arg, &status);
|
rb_protect(pty_exec, (VALUE)&arg, &status);
|
||||||
sleep(1);
|
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
|
#undef ERROR_EXIT
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
require 'test/unit'
|
require 'test/unit'
|
||||||
require_relative 'ruby/envutil'
|
require_relative 'ruby/envutil'
|
||||||
require 'shellwords'
|
require 'shellwords'
|
||||||
|
require 'tmpdir'
|
||||||
|
|
||||||
begin
|
begin
|
||||||
require 'pty'
|
require 'pty'
|
||||||
@ -123,5 +124,12 @@ class TestPTY < Test::Unit::TestCase
|
|||||||
) { master.readpartial(10) }
|
) { master.readpartial(10) }
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_getpty_nonexistent
|
||||||
|
bug3672 = '[ruby-dev:41965]'
|
||||||
|
Dir.mktmpdir do |tmpdir|
|
||||||
|
assert_raise(Errno::ENOENT, bug3672) {PTY.getpty(File.join(tmpdir, "no-such-command"))}
|
||||||
|
end
|
||||||
|
end
|
||||||
end if defined? PTY
|
end if defined? PTY
|
||||||
|
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
#define RUBY_VERSION "1.9.3"
|
#define RUBY_VERSION "1.9.3"
|
||||||
#define RUBY_RELEASE_DATE "2010-09-02"
|
#define RUBY_RELEASE_DATE "2010-09-03"
|
||||||
#define RUBY_PATCHLEVEL -1
|
#define RUBY_PATCHLEVEL -1
|
||||||
#define RUBY_BRANCH_NAME "trunk"
|
#define RUBY_BRANCH_NAME "trunk"
|
||||||
|
|
||||||
#define RUBY_RELEASE_YEAR 2010
|
#define RUBY_RELEASE_YEAR 2010
|
||||||
#define RUBY_RELEASE_MONTH 9
|
#define RUBY_RELEASE_MONTH 9
|
||||||
#define RUBY_RELEASE_DAY 2
|
#define RUBY_RELEASE_DAY 3
|
||||||
|
|
||||||
#include "ruby/version.h"
|
#include "ruby/version.h"
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user