R
Ram
Hi,
The following small script has a child thread which restart the network on a
Linux system. The problem is it never seems to return from the os.spawnlp.
It executes some portions of the network script and then hangs.
If the os.spawnlp is executed in the main thread, it works fine and there is
no problem at all.
os.system also has the same effect as os.spawnlp. Making the thread as a
daemon also has the same effect.
import os
import threading
class Child(threading.Thread):
def __init__(self):
threading.Thread.__init__(self)
def run(self):
os.spawnlp(os.P_WAIT, "/etc/init.d/network", "network", "restart")
if __name__ == '__main__':
t = Child()
t.start()
Any ideas of what could be wrong here?
Thanks in advance
Ram
The following small script has a child thread which restart the network on a
Linux system. The problem is it never seems to return from the os.spawnlp.
It executes some portions of the network script and then hangs.
If the os.spawnlp is executed in the main thread, it works fine and there is
no problem at all.
os.system also has the same effect as os.spawnlp. Making the thread as a
daemon also has the same effect.
import os
import threading
class Child(threading.Thread):
def __init__(self):
threading.Thread.__init__(self)
def run(self):
os.spawnlp(os.P_WAIT, "/etc/init.d/network", "network", "restart")
if __name__ == '__main__':
t = Child()
t.start()
Any ideas of what could be wrong here?
Thanks in advance
Ram