1
0
mirror of https://github.com/gryf/wicd.git synced 2025-12-23 06:37:59 +01:00

added code to escape characters in global scripts

This commit is contained in:
Adam Blackburn
2009-08-09 18:40:29 -05:00
parent 0c111ee635
commit 6e3d6c8d02

View File

@@ -194,7 +194,11 @@ def ExecuteScript(script, verbose=False, extra_parameters=()):
""" Execute a command and send its output to the bit bucket. """
if verbose:
print "Executing %s with params %s" % (script, ' '.join(extra_parameters))
ret = call("%s %s > /dev/null 2>&1" % (script, ' '.join(extra_parameters)), shell=True)
extra_parameters = [ s.replace('"', '\\"') for s in extra_parameters ]
# escape characters
params = '" "'.join(extra_parameters)
script = script.replace(' ', '\\ ')
ret = call('%s "%s" > /dev/null 2>&1' % (script, params), shell=True)
if verbose:
print "%s returned %s" % (script, ret)