eric6/Debugger/DebuggerInterfacePython.py

branch
multi_processing
changeset 7422
9a008ab4811b
parent 7421
4a9900aef04e
child 7564
787684e6f2f3
diff -r 4a9900aef04e -r 9a008ab4811b eric6/Debugger/DebuggerInterfacePython.py
--- a/eric6/Debugger/DebuggerInterfacePython.py	Sun Feb 16 16:14:25 2020 +0100
+++ b/eric6/Debugger/DebuggerInterfacePython.py	Sun Feb 16 19:36:46 2020 +0100
@@ -226,6 +226,10 @@
             redirect = str(Preferences.getDebugger("Python3Redirect"))
             noencoding = (Preferences.getDebugger("Python3NoEncoding") and
                           '--no-encoding' or '')
+        multiprocessEnabled = (
+            '--multiprocess' if Preferences.getDebugger("MultiProcessEnabled")
+            else ''
+        )
         
         if Preferences.getDebugger("RemoteDbgEnabled"):
             ipaddr = self.debugServer.getHostAddress(False)
@@ -235,8 +239,12 @@
                 rhost = "localhost"
             if rexec:
                 args = Utilities.parseOptionString(rexec) + [
-                    rhost, interpreter, debugClient, noencoding, str(port),
-                    redirect, ipaddr]
+                    rhost, interpreter, debugClient]
+                if noencoding:
+                    args.append(noencoding)
+                if multiprocessEnabled:
+                    args.append(multiprocessEnabled)
+                args.extend([str(port), redirect, ipaddr])
                 if Utilities.isWindowsPlatform():
                     if not os.path.splitext(args[0])[1]:
                         for ext in [".exe", ".com", ".cmd", ".bat"]:
@@ -301,8 +309,12 @@
             ccmd = Preferences.getDebugger("ConsoleDbgCommand")
             if ccmd:
                 args = Utilities.parseOptionString(ccmd) + [
-                    interpreter, os.path.abspath(debugClient), noencoding,
-                    str(port), '0', ipaddr]
+                    interpreter, os.path.abspath(debugClient)]
+                if noencoding:
+                    args.append(noencoding)
+                if multiprocessEnabled:
+                    args.append(multiprocessEnabled)
+                args.extend([str(port), '0', ipaddr])
                 args[0] = Utilities.getExecutablePath(args[0])
                 process = self.__startProcess(args[0], args[1:], clientEnv,
                                               workingDir=workingDir)
@@ -315,11 +327,14 @@
                             """ started.</p>"""))
                 return process, self.__isNetworked, interpreter
         
-        process = self.__startProcess(
-            interpreter,
-            [debugClient, noencoding, str(port), redirect, ipaddr],
-            clientEnv,
-            workingDir=workingDir)
+        args = [debugClient]
+        if noencoding:
+            args.append(noencoding)
+        if multiprocessEnabled:
+            args.append(multiprocessEnabled)
+        args.extend([str(port), redirect, ipaddr])
+        process = self.__startProcess(interpreter, args, clientEnv,
+                                      workingDir=workingDir)
         if process is None:
             self.__startedVenv = ""
             E5MessageBox.critical(
@@ -370,7 +385,12 @@
         
         redirect = str(project.getDebugProperty("REDIRECT"))
         noencoding = (
-            project.getDebugProperty("NOENCODING") and '--no-encoding' or '')
+            '--no-encoding' if project.getDebugProperty("NOENCODING") else ''
+        )
+        multiprocessEnabled = (
+            '--multiprocess' if Preferences.getDebugger("MultiProcessEnabled")
+            else ''
+        )
         
         venvManager = e5App().getObject("VirtualEnvManager")
         interpreter = venvManager.getVirtualenvInterpreter(venvName)
@@ -396,8 +416,12 @@
                 rhost = "localhost"
             if rexec:
                 args = Utilities.parseOptionString(rexec) + [
-                    rhost, interpreter, debugClient, noencoding, str(port),
-                    redirect, ipaddr]
+                    rhost, interpreter, debugClient]
+                if noencoding:
+                    args.append(noencoding)
+                if multiprocessEnabled:
+                    args.append(multiprocessEnabled)
+                args.extend([str(port), redirect, ipaddr])
                 if Utilities.isWindowsPlatform():
                     if not os.path.splitext(args[0])[1]:
                         for ext in [".exe", ".com", ".cmd", ".bat"]:
@@ -464,8 +488,12 @@
                     Preferences.getDebugger("ConsoleDbgCommand"))
             if ccmd:
                 args = Utilities.parseOptionString(ccmd) + [
-                    interpreter, os.path.abspath(debugClient), noencoding,
-                    str(port), '0', ipaddr]
+                    interpreter, os.path.abspath(debugClient)]
+                if noencoding:
+                    args.append(noencoding)
+                if multiprocessEnabled:
+                    args.append(multiprocessEnabled)
+                args.extend([str(port), '0', ipaddr])
                 args[0] = Utilities.getExecutablePath(args[0])
                 process = self.__startProcess(args[0], args[1:], clientEnv,
                                               workingDir=workingDir)
@@ -478,11 +506,14 @@
                             """ started.</p>"""))
                 return process, self.__isNetworked, interpreter
         
-        process = self.__startProcess(
-            interpreter,
-            [debugClient, noencoding, str(port), redirect, ipaddr],
-            clientEnv,
-            workingDir=workingDir)
+        args = [debugClient]
+        if noencoding:
+            args.append(noencoding)
+        if multiprocessEnabled:
+            args.append(multiprocessEnabled)
+        args.extend([str(port), redirect, ipaddr])
+        process = self.__startProcess(interpreter, args, clientEnv,
+                                      workingDir=workingDir)
         if process is None:
             self.__startedVenv = ""
             E5MessageBox.critical(

eric ide

mercurial