Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix ruby 2.8/3.0 deprecations about File.exists? #79

Merged
merged 1 commit into from
Jun 11, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Fix ruby 2.8/3.0 deprecations about File.exists?
  • Loading branch information
byroot committed Jun 10, 2020
commit 3afe0eabe9fe67ddae29f88d19f104a47c5a82bb
4 changes: 2 additions & 2 deletions ext/extconf.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ def sys(cmd)

libdir = File.basename RbConfig::CONFIG['libdir']

unless File.exists?("#{CWD}/dst/#{libdir}/libmsgpackc.a")
unless File.exist?("#{CWD}/dst/#{libdir}/libmsgpackc.a")
Logging.message "Building msgpack\n"

msgpack = File.basename('msgpack-1.1.0.tar.gz')
Expand All @@ -28,7 +28,7 @@ def sys(cmd)
end

Dir.chdir('src') do
FileUtils.rm_rf(dir) if File.exists?(dir)
FileUtils.rm_rf(dir) if File.exist?(dir)

sys("tar zxvfo #{msgpack}")
Dir.chdir(dir) do
Expand Down
4 changes: 2 additions & 2 deletions lib/rbtrace/cli.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class RBTraceCLI
#
# Returns nothing.
def self.check_msgmnb
if File.exists?(msgmnb = "/proc/sys/kernel/msgmnb")
if File.exist?(msgmnb = "/proc/sys/kernel/msgmnb")
curr = File.read(msgmnb).to_i
max = 1024*1024
cmd = "sysctl kernel.msgmnb=#{max}"
Expand Down Expand Up @@ -273,7 +273,7 @@ def self.run
file = [
config,
File.expand_path("../../../tracers/#{config}.tracer", __FILE__)
].find{ |f| File.exists?(f) }
].find{ |f| File.exist?(f) }

unless file
parser.die :config, '(file does not exist)'
Expand Down
2 changes: 1 addition & 1 deletion lib/rbtrace/rbtracer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ def socket_path
end

def clean_socket_path
FileUtils.rm(socket_path) if File.exists?(socket_path)
FileUtils.rm(socket_path) if File.exist?(socket_path)
end

# Watch for method calls slower than a threshold.
Expand Down