Skip to content

Commit

Permalink
Fix some warnings slipping in from symlinked gem path.
Browse files Browse the repository at this point in the history
  • Loading branch information
semaperepelitsa committed May 18, 2015
1 parent 21924bb commit df31dcc
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions lib/ruby_warning_filter.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
require 'delegate'
require "delegate"
require "set"

# Filter IO from Ruby warnings that come out of external gems.
# There is no other way currently to filter out Ruby warnings other than hijacking stderr.
Expand All @@ -22,9 +23,16 @@ class RubyWarningFilter < DelegateClass(IO)

def initialize(io, ignore_path: Gem.path)
super(io)

@ruby_warnings = 0
@ignored = false
@ignore_path = ignore_path
@ignore_path = ignore_path.to_set

# Gem path can contain symlinks.
# Some warnings use real path instead of symlinks so we need to ignore both.
ignore_path.each do |a|
@ignore_path << File.realpath(a) if File.exist?(a)
end
end

def write(line)
Expand Down

0 comments on commit df31dcc

Please sign in to comment.