From 6ed4f3ee6e29eaf42f915c4a27330b72d73888d7 Mon Sep 17 00:00:00 2001 From: Florian N Date: Sat, 22 Feb 2014 16:49:27 -0500 Subject: [PATCH] small fix for arch --- main/views.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/main/views.py b/main/views.py index ba11243..e352373 100755 --- a/main/views.py +++ b/main/views.py @@ -71,7 +71,10 @@ def get_ipaddress(): Get the IP Address """ try: - pipe = os.popen("ip addr | grep -A3 'LOWER_UP' | awk '{if ($2 == \"forever\"){printf \"unavailable,,\"} else{ printf \"%s,\",$2}}'|awk -F,, '{print $0}'") + if get_platform()['osname'] == "Linux": + pipe = os.popen("ip addr | grep -A3 'LOWER_UP' | awk '{if ($2 == \"forever\"){printf \"unavailable,\"} else{ printf \"%s,\",$2}}'|awk -F,, '{print $0}'") + else: + pipe = os.popen("ip addr | grep -A3 'LOWER_UP' | awk '{if ($2 == \"forever\"){printf \"unavailable,,\"} else{ printf \"%s,\",$2}}'|awk -F,, '{print $0}'") data = pipe.read().strip().split(',,') pipe.close()