From 4cf5ad3f3e84b518965061e6be8bae42e1e4137f Mon Sep 17 00:00:00 2001 From: Kartikaya Gupta Date: Tue, 3 Jan 2012 15:15:02 -0500 Subject: [PATCH] Bug 714903 - Fix getLanIp to work with Mac OS X as well instead of dying with an exception. r=jmaher --- build/mobile/devicemanager.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/build/mobile/devicemanager.py b/build/mobile/devicemanager.py index ad875011942..16dc9e67af0 100755 --- a/build/mobile/devicemanager.py +++ b/build/mobile/devicemanager.py @@ -500,7 +500,10 @@ class NetworkTools: return None def getLanIp(self): - ip = socket.gethostbyname(socket.gethostname()) + try: + ip = socket.gethostbyname(socket.gethostname()) + except socket.gaierror: + ip = socket.gethostbyname(socket.gethostname() + ".local") # for Mac OS X if ip.startswith("127.") and os.name != "nt": interfaces = ["eth0","eth1","eth2","wlan0","wlan1","wifi0","ath0","ath1","ppp0"] for ifname in interfaces: