Commit 7cb50891 authored by Robert Loehning's avatar Robert Loehning
Browse files

Squish: Don't use global variable for __isWinFirewallRunning__()



Change-Id: Iaad1da549addbb856515ae95ece4ae43246637fa
Reviewed-by: default avatarChristian Stenger <christian.stenger@digia.com>
parent fac11973
import re import re
# flag that caches the information whether Windows firewall is running or not
fireWallState = None
# this function modifies all necessary run settings to make it possible to hook into # this function modifies all necessary run settings to make it possible to hook into
# the application compiled by Creator # the application compiled by Creator
...@@ -310,17 +308,16 @@ def __configureFW__(workingDir, projectName, isReleaseBuild, addToFW=True): ...@@ -310,17 +308,16 @@ def __configureFW__(workingDir, projectName, isReleaseBuild, addToFW=True):
# helper to check whether win firewall is running or not # helper to check whether win firewall is running or not
# this doesn't check for other firewalls! # this doesn't check for other firewalls!
def __isWinFirewallRunning__(): def __isWinFirewallRunning__():
global fireWallState if hasattr(__isWinFirewallRunning__, "fireWallState"):
if fireWallState != None: return __isWinFirewallRunning__.fireWallState
return fireWallState
if not platform.system() in ('Microsoft' 'Windows'): if not platform.system() in ('Microsoft' 'Windows'):
fireWallState = False __isWinFirewallRunning__.fireWallState = False
return False return False
result = getOutputFromCmdline("netsh firewall show state") result = getOutputFromCmdline("netsh firewall show state")
for line in result.splitlines(): for line in result.splitlines():
if "Operational mode" in line: if "Operational mode" in line:
fireWallState = not "Disable" in line __isWinFirewallRunning__.fireWallState = not "Disable" in line
return fireWallState return __isWinFirewallRunning__.fireWallState
return None return None
# this function adds the given executable as an attachable AUT # this function adds the given executable as an attachable AUT
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment