diff options
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | process.c | 2 | ||||
-rw-r--r-- | test/ruby/test_process.rb | 18 |
3 files changed, 24 insertions, 1 deletions
@@ -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 @@ -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 |