krawaller / kranium

Brains for Titanium
http://www.kraniumjs.com
Other
103 stars 13 forks source link

fix getnetworkip in linux #11

Closed sevir closed 12 years ago

sevir commented 12 years ago

the correct regexp in linux

line 18 - before: filterRE = /\binet\b[^:]+:\s([^\s]+)/g; after: filterRE = /\binet:\s([^\s]+)/g;

Seems that the code is copy of http://stackoverflow.com/a/3742915 , and the author says:

" (tested on MacOS Snow Leopard only; hope it works on linux too) "

;)

sevir commented 12 years ago

I've changed getnetworkip for multiplatform work using os module and methods getNetworkInterfaces (in Node v0.5.x, deprecated in v0.6.x) and networkInterfaces (renamed in v0.6.x)

I've maintained the old code of compatibility with versions 0.4.x using ifconfig command.

krawaller commented 12 years ago

Beautiful! Thank you.