From f3dfd1d57748d7f0a8dbd000cfce3a6bd9a0c476 Mon Sep 17 00:00:00 2001 From: Tobias Witek Date: Sat, 14 Apr 2018 05:33:35 +0200 Subject: [PATCH] [modules/nic] Do not fail if iwgetid is not available Instead of throwing an error, simply return an empty SSID. Also, for these cases, make sure the module doesn't output multiple whitespaces as the end. fixes #248 --- bumblebee/modules/nic.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/bumblebee/modules/nic.py b/bumblebee/modules/nic.py index c744e86..98b089c 100644 --- a/bumblebee/modules/nic.py +++ b/bumblebee/modules/nic.py @@ -93,7 +93,8 @@ class Module(bumblebee.engine.Module): if not widget: widget = bumblebee.output.Widget(name=intf) widgets.append(widget) - widget.full_text(self._format.format(ip=", ".join(addr),intf=intf,state=state,ssid=self.get_ssid(intf))) + # join/split is used to get rid of multiple whitespaces (in case SSID is not available, for instance + widget.full_text(" ".join(self._format.format(ip=", ".join(addr),intf=intf,state=state,ssid=self.get_ssid(intf)).split())) widget.set("intf", intf) widget.set("state", state) widget.set("visited", True) @@ -106,7 +107,7 @@ class Module(bumblebee.engine.Module): if self._iswlan(intf): try: return subprocess.check_output(["iwgetid","-r",intf]).strip().decode('utf-8') - except subprocess.CalledProcessError: + except: return "" return ""