1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

process.c: open exception message

* process.c (rb_execarg_parent_start1): raise with the target path
  name when open() failed.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51787 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2015-09-07 15:14:46 +00:00
parent be3de529c2
commit cfecd21a89
3 changed files with 24 additions and 1 deletions

View file

@ -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

View file

@ -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);

View file

@ -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