ruby-changes:50936
From: nobu <ko1@a...>
Date: Fri, 13 Apr 2018 15:26:34 +0900 (JST)
Subject: [ruby-changes:50936] nobu:r63143 (trunk): file.c: chardev is loadable
nobu 2018-04-13 15:26:30 +0900 (Fri, 13 Apr 2018) New Revision: 63143 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=63143 Log: file.c: chardev is loadable * file.c (ruby_is_fd_loadable): allow character devices to load, e.g., `ruby /dev/null` exits successfully. Modified files: trunk/file.c trunk/test/ruby/test_rubyoptions.rb Index: file.c =================================================================== --- file.c (revision 63142) +++ file.c (revision 63143) @@ -5959,7 +5959,7 @@ ruby_is_fd_loadable(int fd) https://github.com/ruby/ruby/blob/trunk/file.c#L5959 if (S_ISREG(st.st_mode)) return 1; - if (S_ISFIFO(st.st_mode)) + if (S_ISFIFO(st.st_mode) || S_ISCHR(st.st_mode)) return -1; if (S_ISDIR(st.st_mode)) Index: test/ruby/test_rubyoptions.rb =================================================================== --- test/ruby/test_rubyoptions.rb (revision 63142) +++ test/ruby/test_rubyoptions.rb (revision 63143) @@ -1020,4 +1020,9 @@ class TestRubyOptions < Test::Unit::Test https://github.com/ruby/ruby/blob/trunk/test/ruby/test_rubyoptions.rb#L1020 end end end + + def test_null_script + skip "#{IO::NULL} is not a character device" unless File.chardev?(IO::NULL) + assert_in_out_err([IO::NULL], success: true) + end end -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/