Fixed an issue with the MultiProcess extension for the subprocess module causing Popen to fail when the first argument was passed as a keyword (see issue 550). eric7

Wed, 06 Mar 2024 09:36:09 +0100

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Wed, 06 Mar 2024 09:36:09 +0100
branch
eric7
changeset 10627
40b3df5b933a
parent 10626
42c3c948aafa
child 10628
6968d6c31b3e

Fixed an issue with the MultiProcess extension for the subprocess module causing Popen to fail when the first argument was passed as a keyword (see issue 550).

src/eric7/DebugClients/Python/SubprocessExtension.py file | annotate | diff | comparison | revisions
--- a/src/eric7/DebugClients/Python/SubprocessExtension.py	Mon Mar 04 18:16:19 2024 +0100
+++ b/src/eric7/DebugClients/Python/SubprocessExtension.py	Wed Mar 06 09:36:09 2024 +0100
@@ -37,13 +37,13 @@
         Wrapper class for subprocess.Popen.
         """
 
-        def __init__(self, arguments, *args, **kwargs):
+        def __init__(self, args, *popenargs, **kwargs):
             """
             Constructor
 
-            @param arguments command line arguments for the new process
+            @param args command line arguments for the new process
             @type list of str or str
-            @param args constructor arguments of Popen
+            @param popenargs constructor arguments of Popen
             @type list
             @param kwargs constructor keyword only arguments of Popen
             @type dict
@@ -51,30 +51,30 @@
             if (
                 _debugClient.debugging
                 and _debugClient.multiprocessSupport
-                and isinstance(arguments, (str, list))
+                and isinstance(args, (str, list))
             ):
-                if isinstance(arguments, str):
+                if isinstance(args, str):
                     # convert to arguments list
-                    arguments = (
-                        stringToArgumentsWindows(arguments)
+                    args = (
+                        stringToArgumentsWindows(args)
                         if isWindowsPlatform()
-                        else shlex.split(arguments)
+                        else shlex.split(args)
                     )
                 else:
                     # create a copy of the arguments
-                    arguments = arguments[:]
-                ok = isPythonProgram(arguments[0])
+                    args = args[:]
+                ok = isPythonProgram(args[0])
                 if ok:
-                    scriptName = os.path.basename(arguments[0])
+                    scriptName = os.path.basename(args[0])
                     if not _debugClient.skipMultiProcessDebugging(scriptName):
-                        arguments = patchArguments(
-                            _debugClient, arguments, noRedirect=True
+                        args = patchArguments(
+                            _debugClient, args, noRedirect=True
                         )
                     if "shell" in kwargs and kwargs["shell"] is True:
                         # shell=True interferes with eric debugger
                         kwargs["shell"] = False
 
-            super().__init__(arguments, *args, **kwargs)
+            super().__init__(args, *popenargs, **kwargs)
 
     _debugClient = debugClient
     module.Popen = PopenWrapper

eric ide

mercurial