Start the background client always as external process. Py2 comp.

Sat, 12 Apr 2014 22:39:33 +0200

author
T.Rzepka <Tobias.Rzepka@gmail.com>
date
Sat, 12 Apr 2014 22:39:33 +0200
branch
Py2 comp.
changeset 3505
84e7cee47d10
parent 3496
b905cb8c520c
child 3506
d85fadb263a0

Start the background client always as external process.

Utilities/BackgroundService.py file | annotate | diff | comparison | revisions
--- a/Utilities/BackgroundService.py	Thu Apr 10 23:03:29 2014 +0200
+++ b/Utilities/BackgroundService.py	Sat Apr 12 22:39:33 2014 +0200
@@ -15,7 +15,6 @@
 import os
 import struct
 import sys
-import threading
 from zlib import adler32
 
 from PyQt4.QtCore import QProcess, pyqtSignal
@@ -24,7 +23,6 @@
 
 import Preferences
 import Utilities
-from Utilities.BackgroundClient import BackgroundClient
 
 from eric5config import getConfig
 
@@ -59,19 +57,10 @@
         port = self.serverPort()
         ## NOTE: Need the port if started external in debugger:
         print('BackgroundService listening on: %i' % port)
-        if sys.platform == 'win32':
-            interpreterCompare = Utilities.samefilepath
-        else:
-            interpreterCompare = Utilities.samepath
-        
         for pyName in ['Python', 'Python3']:
             interpreter = Preferences.getDebugger(
                 pyName + "Interpreter")
-            
-            if interpreterCompare(interpreter, sys.executable):
-                process = self.__startInternalClient(port)
-            else:
-                process = self.__startExternalClient(interpreter, port)
+            process = self.__startExternalClient(interpreter, port)
             if process:
                 self.processes.append(process)
 
@@ -95,19 +84,6 @@
         if not proc.waitForStarted(10000):
             proc = None
         return proc
-
-    def __startInternalClient(self, port):
-        """
-        Private method to start the background client as internal thread.
-        
-        @param port socket port to which the interpreter should connect (int)
-        @return the thread object (Thread) or None
-        """
-        backgroundClient = BackgroundClient(
-            self.hostAddress, port)
-        thread = threading.Thread(target=backgroundClient.run)
-        thread.start()
-        return thread
     
     def __processQueue(self):
         """
@@ -298,9 +274,5 @@
                 connection.close()
         
         for process in self.processes:
-            if isinstance(process, QProcess):
-                process.close()
-                process = None
-            elif isinstance(process, threading.Thread):
-                process.join(0.1)
-                process = None
+            process.close()
+            process = None

eric ide

mercurial