Skip to content

Conversation

@taketo1113
Copy link

This Pull Request fixes an issue where an undefined method '=~' for false error is output to the exception attribute when Net::Ping::External#ping6 succeeds.

Steps to reproduce

  • ruby: 3.4.1
  • net-ping: 2.0.8
  • OS: CentOS Stream 9
require 'net/ping'

pe = Net::Ping::External.new("2001:4860:4860::8888") # dns.google
pe.ping6
=> true

pe.exception
=> "undefined method '=~' for false"

Expected behavior

When Net::Ping::External#ping6 succeeds, the exception attribute should be nil, similar to how it behaves with Net::Ping::External#ping.

# ping6
pe = Net::Ping::External.new("2001:4860:4860::8888") # dns.google
pe.ping6
=> true

pe.exception
=> nil


# ping
pe4 = Net::Ping::External.new("8.8.8.8") # dns.google
pe4.ping
=> true

pe4.exception
=> nil

Actual behavior

When Net::Ping::External#ping6 succeeds, the exception attribute is not nil and instead has the value undefined method '=~' for false.

# ping6
pe = Net::Ping::External.new("2001:4860:4860::8888") # dns.google
pe.ping6
=> true

pe.exception
=> "undefined method '=~' for false"


# ping
pe4 = Net::Ping::External.new("8.8.8.8") # dns.google
pe4.ping
=> true

pe4.exception
=> nil

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant