mirror of
https://github.com/gryf/wicd.git
synced 2025-12-19 20:38:00 +01:00
Changed script execution behavior to fork before running. Causes more reliable execution but can leave zombies.
This commit is contained in:
17
misc.py
17
misc.py
@@ -37,7 +37,7 @@ def PromptToStartDaemon():
|
||||
print 'You need to start the daemon before using the gui or tray. Use the command \'sudo /etc/init.d/wicd start\'.'
|
||||
|
||||
def RunRegex(regex,string):
|
||||
m = regex.search( string )
|
||||
m = regex.search(string)
|
||||
if m:
|
||||
return m.groups()[0]
|
||||
else:
|
||||
@@ -46,6 +46,19 @@ def RunRegex(regex,string):
|
||||
def WriteLine(file,text):
|
||||
file.write(text + "\n")
|
||||
|
||||
def ExecuteScript(script):
|
||||
pid = os.fork()
|
||||
if not pid:
|
||||
os.setsid()
|
||||
os.umask(0)
|
||||
pid = os.fork()
|
||||
if not pid:
|
||||
print Run('./run-script.py ' + script)
|
||||
os._exit(0)
|
||||
os._exit(0)
|
||||
os.wait()
|
||||
|
||||
|
||||
def ReadFile(filename):
|
||||
if not os.path.exists(filename):
|
||||
return None
|
||||
@@ -136,6 +149,6 @@ def LoadEncryptionMethods():
|
||||
def noneToString(text):
|
||||
'''used for putting text in a text box if the value to put in is 'None' the box will be blank'''
|
||||
if text == None or text == "None" or text == "":
|
||||
return "None"
|
||||
return "None"
|
||||
else:
|
||||
return str(text)
|
||||
|
||||
Reference in New Issue
Block a user