ruby-changes:39706
From: nobu <ko1@a...>
Date: Tue, 8 Sep 2015 00:15:08 +0900 (JST)
Subject: [ruby-changes:39706] nobu:r51787 (trunk): process.c: open exception message
nobu 2015-09-08 00:14:46 +0900 (Tue, 08 Sep 2015) New Revision: 51787 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=51787 Log: process.c: open exception message * process.c (rb_execarg_parent_start1): raise with the target path name when open() failed. Modified files: trunk/ChangeLog trunk/process.c trunk/test/ruby/test_process.rb Index: ChangeLog =================================================================== --- ChangeLog (revision 51786) +++ ChangeLog (revision 51787) @@ -1,3 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1 +Tue Sep 8 00:14:43 2015 Nobuyoshi Nakada <nobu@r...> + + * 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@r...> * process.c (rb_exec_fail): raise with the target directory name Index: process.c =================================================================== --- process.c (revision 51786) +++ process.c (revision 51787) @@ -2334,7 +2334,7 @@ rb_execarg_parent_start1(VALUE execarg_o https://github.com/ruby/ruby/blob/trunk/process.c#L2334 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); Index: test/ruby/test_process.rb =================================================================== --- test/ruby/test_process.rb (revision 51786) +++ test/ruby/test_process.rb (revision 51787) @@ -424,6 +424,24 @@ class TestProcess < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_process.rb#L424 } 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 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/