Ticket #565: deluge_patch2

File deluge_patch2, 1.7 KB (added by Lajnold, 15 years ago)

Makes gtkui wait for the (temporary) deluged process to finish after Popen.

Line 
1Index: deluge/ui/gtkui/connectionmanager.py
2===================================================================
3--- deluge/ui/gtkui/connectionmanager.py        (revision 4088)
4+++ deluge/ui/gtkui/connectionmanager.py        (working copy)
5@@ -127,10 +127,7 @@
6         # If classic mode is set, we just start up a localhost daemon and connect to it
7         if self.gtkui_config["classic_mode"]:
8             uri = "http://localhost:58846"
9-            if deluge.common.windows_check():
10-                win32api.WinExec("deluged -p 58846")
11-            else:
12-                subprocess.Popen(["deluged", "-p 58846"])
13+            self.start_localhost(58846)
14             time.sleep(0.1)
15             # We need to wait for the host to start before connecting
16             while not self.test_online_status(uri):
17@@ -162,10 +159,7 @@
18                     port = uri[7:].split(":")[1]
19                     # First add it to the list
20                     self.add_host("localhost", port)
21-                    if deluge.common.windows_check():
22-                        win32api.WinExec("deluged -p %s" % port)
23-                    else:
24-                        subprocess.Popen(["deluged", "-p %s" % port])
25+                    self.start_localhost(port)
26                     # We need to wait for the host to start before connecting
27                     while not self.test_online_status(uri):
28                         time.sleep(0.01)
29@@ -440,7 +434,7 @@
30         if deluge.common.windows_check():
31             win32api.WinExec("deluged -p %s" % port)
32         else:
33-            subprocess.Popen(["deluged", "-p %s" % port])
34+            subprocess.Popen(["deluged", "-p %s" % port]).wait()
35 
36     def on_button_close_clicked(self, widget):
37         log.debug("on_button_close_clicked")