diff options
author | Kali Kaneko <kali@leap.se> | 2014-05-19 23:58:06 -0500 |
---|---|---|
committer | Kali Kaneko <kali@leap.se> | 2014-05-19 23:58:06 -0500 |
commit | ba175e3e5e40c2fcdb5657cd16097e2b2252f41b (patch) | |
tree | 8d73acf47d9aaeb198e00d20d1678cbf3c3a3653 /src/leap/bitmask | |
parent | 69ba2e3b46c7b3c4aba0f82f85aa64f6b5633562 (diff) |
backward compat for psutil p.cmdline. Closes: #5689
Diffstat (limited to 'src/leap/bitmask')
-rw-r--r-- | src/leap/bitmask/services/eip/vpnprocess.py | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/leap/bitmask/services/eip/vpnprocess.py b/src/leap/bitmask/services/eip/vpnprocess.py index 1559ea8b..734b88df 100644 --- a/src/leap/bitmask/services/eip/vpnprocess.py +++ b/src/leap/bitmask/services/eip/vpnprocess.py @@ -30,9 +30,11 @@ import psutil try: # psutil < 2.0.0 from psutil.error import AccessDenied as psutil_AccessDenied + PSUTIL_2 = False except ImportError: # psutil >= 2.0.0 from psutil import AccessDenied as psutil_AccessDenied + PSUTIL_2 = True from leap.bitmask.config import flags from leap.bitmask.config.providerconfig import ProviderConfig @@ -676,7 +678,13 @@ class VPNManager(object): # we need to be able to filter out arguments in the form # --openvpn-foo, since otherwise we are shooting ourselves # in the feet. - if any(map(lambda s: s.find("LEAPOPENVPN") != -1, p.cmdline)): + + if PSUTIL_2: + cmdline = p.cmdline() + else: + cmdline = p.cmdline + if any(map(lambda s: s.find( + "LEAPOPENVPN") != -1, cmdline)): openvpn_process = p break except psutil_AccessDenied: |