lib/macaddr.rb in macaddr-1.6.6 vs lib/macaddr.rb in macaddr-1.6.7

- old
+ new

@@ -21,11 +21,11 @@ end require 'systemu' module Mac - VERSION = '1.6.6' + VERSION = '1.6.7' def Mac.version ::Mac::VERSION end @@ -55,17 +55,14 @@ # Mac.addr # => first address # Mac.addr.list # => all addresses def address return @mac_address if defined? @mac_address and @mac_address - re = %r/[^:\-](?:[0-9A-F][0-9A-F][:\-]){5}[0-9A-F][0-9A-F][^:\-]/io cmds = '/sbin/ifconfig', '/bin/ifconfig', 'ifconfig', 'ipconfig /all', 'cat /sys/class/net/*/address' - null = test(?e, '/dev/null') ? '/dev/null' : 'NUL' - output = nil cmds.each do |cmd| - status, stdout, stderr = systemu(cmd) rescue next + _, stdout, _ = systemu(cmd) rescue next next unless stdout and stdout.size > 0 output = stdout and break end raise "all of #{ cmds.join ' ' } failed" unless output