Skip to content

Commit

Permalink
For cygwin, try /dev/null first then fall back to NUL
Browse files Browse the repository at this point in the history
  • Loading branch information
drbrain authored and lsegal committed May 14, 2011
1 parent ae0af87 commit f6570a0
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions lib/rubygems/user_interaction.rb
Expand Up @@ -512,15 +512,16 @@ def initialize

reader, writer = nil, nil

if Gem.win_platform?
reader = File.open('nul', 'r')
writer = File.open('nul', 'w')
else
begin
reader = File.open('/dev/null', 'r')
writer = File.open('/dev/null', 'w')
rescue Errno::ENOENT => e
reader = File.open('nul', 'r')
writer = File.open('nul', 'w')
end

super reader, writer, writer
end

end

0 comments on commit f6570a0

Please sign in to comment.