ruby-changes:39628
From: hsbt <ko1@a...>
Date: Thu, 27 Aug 2015 18:06:12 +0900 (JST)
Subject: [ruby-changes:39628] hsbt:r51709 (trunk): * lib/webrick/server.rb: use IO::NULL instead of '/dev/null'
hsbt 2015-08-27 18:05:48 +0900 (Thu, 27 Aug 2015) New Revision: 51709 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=51709 Log: * lib/webrick/server.rb: use IO::NULL instead of '/dev/null' * test/ruby/test_string.rb: ditto. Modified files: trunk/ChangeLog trunk/lib/webrick/server.rb trunk/test/ruby/test_string.rb Index: ChangeLog =================================================================== --- ChangeLog (revision 51708) +++ ChangeLog (revision 51709) @@ -1,3 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1 +Thu Aug 27 18:05:42 2015 SHIBATA Hiroshi <hsbt@r...> + + * lib/webrick/server.rb: use IO::NULL instead of '/dev/null' + * test/ruby/test_string.rb: ditto. + Thu Aug 27 15:24:57 2015 Koichi Sasada <ko1@a...> * compile.c (iseq_set_sequence): rename variable names Index: lib/webrick/server.rb =================================================================== --- lib/webrick/server.rb (revision 51708) +++ lib/webrick/server.rb (revision 51709) @@ -48,9 +48,9 @@ module WEBrick https://github.com/ruby/ruby/blob/trunk/lib/webrick/server.rb#L48 exit!(0) if fork Dir::chdir("/") File::umask(0) - STDIN.reopen("/dev/null") - STDOUT.reopen("/dev/null", "w") - STDERR.reopen("/dev/null", "w") + STDIN.reopen(IO::NULL) + STDOUT.reopen(IO::NULL, "w") + STDERR.reopen(IO::NULL, "w") yield if block_given? end end Index: test/ruby/test_string.rb =================================================================== --- test/ruby/test_string.rb (revision 51708) +++ test/ruby/test_string.rb (revision 51709) @@ -464,8 +464,7 @@ class TestString < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_string.rb#L464 end end - null = File.exist?("/dev/null") ? "/dev/null" : "NUL" # maybe DOSISH - assert_equal("", File.read(null).clone, '[ruby-dev:32819] reported by Kazuhiro NISHIYAMA') + assert_equal("", File.read(IO::NULL).clone, '[ruby-dev:32819] reported by Kazuhiro NISHIYAMA') end def test_concat -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/