On Jul 3, 2007, at 12:31 PM, ara.t.howard wrote:

>
> On Jul 3, 2007, at 1:13 PM, Tim Pease wrote:
>
>>
>>
>> Seems to be working on windows (except the annoying "command not
>> found" messages).
>
>
> will this work on windoze?
>
>     def mac_address
>       return @mac_address if defined? @mac_address
>       re = %r/[^:\-](?:[0-9A-Za-z][0-9A-Za-z][:\-]){5}[0-9A-Za-z] 
> [0-9A-Za-z][^:\-]/o
>       cmds = '/sbin/ifconfig', '/bin/ifconfig', 'ifconfig',  
> 'ipconfig /all'
>
>       null = test(?e, '/dev/null') ? '/dev/null' : 'NUL'
>
>       lines = nil
>       cmds.each do |cmd|
>         stdout = IO.popen("#{ cmd } 2> #{ null }"){|fd|  
> fd.readlines} rescue next
>                                    #
>                                    # ok on windoze?
>         next unless stdout and stdout.size > 0
>         lines = stdout and break
>       end
>       raise "all of #{ cmds.join ' ' } failed" unless lines
>
>       candidates = lines.select{|line| line =~ re}
>       raise 'no mac address candidates' unless candidates.first
>
>       maddr = candidates.first[re]
>       raise 'no mac address found' unless maddr
>       @mac_address = maddr.strip
>     end

	This one works for me on OSX, Gentoo and windows.

Cheers-
-- Ezra Zygmuntowicz 
-- Lead Rails Evangelist
-- ez / engineyard.com
-- Engine Yard, Serious Rails Hosting
-- (866) 518-YARD (9273)