summaryrefslogtreecommitdiff
path: root/src/leap/bitmask/vpn/fw
diff options
context:
space:
mode:
authorKali Kaneko (leap communications) <kali@leap.se>2017-06-01 01:33:09 +0200
committerKali Kaneko (leap communications) <kali@leap.se>2017-06-07 12:31:24 +0200
commit1c418514c6f3ea57570023833ef66d2c9d3473f2 (patch)
tree89b3645240479e5fc5e4d7435d1a0a95722efa4c /src/leap/bitmask/vpn/fw
parent3eb5687d1dc5236dab55930c58dcf7da2196234e (diff)
[feature] log output of subprocess call
Diffstat (limited to 'src/leap/bitmask/vpn/fw')
-rw-r--r--src/leap/bitmask/vpn/fw/firewall.py20
1 files changed, 13 insertions, 7 deletions
diff --git a/src/leap/bitmask/vpn/fw/firewall.py b/src/leap/bitmask/vpn/fw/firewall.py
index 7f3f4049..95130b25 100644
--- a/src/leap/bitmask/vpn/fw/firewall.py
+++ b/src/leap/bitmask/vpn/fw/firewall.py
@@ -23,9 +23,13 @@ import commands
import os
import subprocess
+from twisted.logger import getLogger
+
from leap.bitmask.vpn.constants import IS_MAC
from leap.common.events import catalog, emit_async
+log = getLogger()
+
# TODO -- subclass it for osx/windows, not only for linux.
@@ -82,14 +86,16 @@ class FirewallManager(object):
if restart:
cmd.append("restart")
- # FIXME -- use a processprotocol
- exitCode = subprocess.call(cmd + gateways)
- emit_async(catalog.VPN_STATUS_CHANGED)
-
- if exitCode == 0:
- return True
+ try:
+ result = subprocess.check_output(
+ cmd + gateways,
+ stderr=subprocess.STDOUT)
+ except Exception:
+ log.failure('Error launching the firewall')
else:
- return False
+ log.debug(result)
+ emit_async(catalog.VPN_STATUS_CHANGED)
+ return True
def stop(self):
"""