aboutsummaryrefslogtreecommitdiffstats
path: root/lib/rubygems/util.rb
diff options
context:
space:
mode:
authorhsbt <hsbt@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-05-30 13:01:35 +0000
committerhsbt <hsbt@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-05-30 13:01:35 +0000
commit8da8d4b043c37b53a69803c71ff36b478d4776d0 (patch)
tree7c8cec15645e74f19c88e4eb5b210b96174c7d03 /lib/rubygems/util.rb
parentc5cb386eba6d9a2d9a8e6ffa8c30137d0c4660c1 (diff)
downloadruby-8da8d4b043c37b53a69803c71ff36b478d4776d0.tar.gz
Merge RubyGems 3.0.0.beta1.
* It drop to support < Ruby 2.2 * Cleanup deprecated methods and classes. * Mark obsoleted methods to deprecate. * and other enhancements. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63528 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/rubygems/util.rb')
-rw-r--r--lib/rubygems/util.rb14
1 files changed, 5 insertions, 9 deletions
diff --git a/lib/rubygems/util.rb b/lib/rubygems/util.rb
index 6c75910004..9f5b9a2239 100644
--- a/lib/rubygems/util.rb
+++ b/lib/rubygems/util.rb
@@ -15,7 +15,7 @@ module Gem::Util
data = StringIO.new(data, 'r')
unzipped = Zlib::GzipReader.new(data).read
- unzipped.force_encoding Encoding::BINARY if Object.const_defined? :Encoding
+ unzipped.force_encoding Encoding::BINARY
unzipped
end
@@ -26,7 +26,7 @@ module Gem::Util
require 'zlib'
require 'stringio'
zipped = StringIO.new(String.new, 'w')
- zipped.set_encoding Encoding::BINARY if Object.const_defined? :Encoding
+ zipped.set_encoding Encoding::BINARY
Zlib::GzipWriter.wrap zipped do |io| io.write data end
@@ -67,13 +67,11 @@ module Gem::Util
end
end
- NULL_DEVICE = defined?(IO::NULL) ? IO::NULL : Gem.win_platform? ? 'NUL' : '/dev/null'
-
##
# Invokes system, but silences all output.
def self.silent_system *command
- opt = {:out => NULL_DEVICE, :err => [:child, :out]}
+ opt = {:out => IO::NULL, :err => [:child, :out]}
if Hash === command.last
opt.update(command.last)
cmds = command[0...-1]
@@ -86,15 +84,13 @@ module Gem::Util
@silent_mutex ||= Mutex.new
- null_device = NULL_DEVICE
-
@silent_mutex.synchronize do
begin
stdout = STDOUT.dup
stderr = STDERR.dup
- STDOUT.reopen null_device, 'w'
- STDERR.reopen null_device, 'w'
+ STDOUT.reopen IO::NULL, 'w'
+ STDERR.reopen IO::NULL, 'w'
return system(*command)
ensure