Sat, 15 Jan 2022 17:15:24 +0100
Debug Client
- fixed an issue handling string arguments for subprocess.run() on Windows platforms (handling of "")
eric7/DebugClients/Python/DebugUtilities.py | file | annotate | diff | comparison | revisions | |
eric7/DebugClients/Python/SubprocessExtension.py | file | annotate | diff | comparison | revisions |
--- a/eric7/DebugClients/Python/DebugUtilities.py Thu Jan 13 19:40:00 2022 +0100 +++ b/eric7/DebugClients/Python/DebugUtilities.py Sat Jan 15 17:15:24 2022 +0100 @@ -397,7 +397,7 @@ @exception RuntimeError raised to indicate an illegal arguments parsing condition """ - # see http:#msdn.microsoft.com/en-us/library/a1y7w461.aspx + # see http://msdn.microsoft.com/en-us/library/a1y7w461.aspx result = [] DEFAULT = 0 @@ -409,10 +409,12 @@ buf = '' argsLen = len(args) - for i in range(argsLen): + i=0 + while i < argsLen: ch = args[i] if ch == '\\': backslashes += 1 + i += 1 continue elif backslashes != 0: if ch == '"': @@ -425,6 +427,7 @@ buf += '"' backslashes = 0 + i += 1 continue else: # false alarm, treat passed backslashes literally... @@ -438,11 +441,13 @@ if ch in (' ', '\t'): if state == DEFAULT: # skip + i += 1 continue elif state == ARG: state = DEFAULT result.append(buf) buf = '' + i += 1 continue if state not in (DEFAULT, ARG, IN_DOUBLE_QUOTE): @@ -470,6 +475,8 @@ else: state = ARG buf += ch + + i += 1 if len(buf) > 0 or state != DEFAULT: result.append(buf)
--- a/eric7/DebugClients/Python/SubprocessExtension.py Thu Jan 13 19:40:00 2022 +0100 +++ b/eric7/DebugClients/Python/SubprocessExtension.py Sat Jan 15 17:15:24 2022 +0100 @@ -11,7 +11,10 @@ import os import shlex -from DebugUtilities import isPythonProgram, patchArguments +from DebugUtilities import ( + isPythonProgram, patchArguments, stringToArgumentsWindows, + isWindowsPlatform +) _debugClient = None @@ -49,7 +52,11 @@ ): if isinstance(arguments, str): # convert to arguments list - arguments = shlex.split(arguments) + arguments = ( + stringToArgumentsWindows(arguments) + if isWindowsPlatform() else + shlex.split(arguments) + ) else: # create a copy of the arguments arguments = arguments[:]