summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rw-r--r--process.c2
-rw-r--r--test/ruby/test_process.rb18
3 files changed, 24 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index a167cdfcb7..1652493e6b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Tue Sep 8 00:14:43 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * process.c (rb_execarg_parent_start1): raise with the target path
+ name when open() failed.
+
Mon Sep 7 23:45:28 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
* process.c (rb_exec_fail): raise with the target directory name
diff --git a/process.c b/process.c
index 9849b2ec1e..8081ce86f1 100644
--- a/process.c
+++ b/process.c
@@ -2334,7 +2334,7 @@ rb_execarg_parent_start1(VALUE execarg_obj)
rb_thread_check_ints();
goto again;
}
- rb_sys_fail("open");
+ rb_syserr_fail_str(open_data.err, vpath);
}
fd2 = open_data.ret;
rb_update_max_fd(fd2);
diff --git a/test/ruby/test_process.rb b/test/ruby/test_process.rb
index cd649053c0..6828c50bf1 100644
--- a/test/ruby/test_process.rb
+++ b/test/ruby/test_process.rb
@@ -424,6 +424,24 @@ class TestProcess < Test::Unit::TestCase
}
end
+ def test_execopts_open_failure
+ with_tmpchdir {|d|
+ assert_raise_with_message(Errno::ENOENT, %r"d/notexist") {
+ Process.wait Process.spawn(*PWD, :in => "d/notexist")
+ }
+ assert_raise_with_message(Errno::ENOENT, %r"d/notexist") {
+ Process.wait Process.spawn(*PWD, :out => "d/notexist")
+ }
+ n = "d/\u{1F37A}"
+ assert_raise_with_message(Errno::ENOENT, /#{n}/) {
+ Process.wait Process.spawn(*PWD, :in => n)
+ }
+ assert_raise_with_message(Errno::ENOENT, /#{n}/) {
+ Process.wait Process.spawn(*PWD, :out => n)
+ }
+ }
+ end
+
UMASK = [RUBY, '-e', 'printf "%04o\n", File.umask']
def test_execopts_umask