--- a/src/eric7/DebugClients/Python/SubprocessExtension.py Fri Dec 06 09:12:46 2024 +0100 +++ b/src/eric7/DebugClients/Python/SubprocessExtension.py Fri Dec 06 14:16:23 2024 +0100 @@ -10,6 +10,7 @@ import os import shlex +import shutil from DebugUtilities import ( isPythonProgram, @@ -55,22 +56,37 @@ ): if isinstance(args, str): # convert to arguments list - args = ( + args_list = ( stringToArgumentsWindows(args) if isWindowsPlatform() else shlex.split(args) ) else: # create a copy of the arguments - args = args[:] - ok = isPythonProgram(args[0]) - if ok: - scriptName = os.path.basename(args[0]) + args_list = args[:] + isPythonProg = isPythonProgram( + args_list[0], + withPath="shell" in kwargs and kwargs["shell"] is True, + ) + if isPythonProg: + scriptName = os.path.basename(args_list[0]) if not _debugClient.skipMultiProcessDebugging(scriptName): - args = patchArguments(_debugClient, args, noRedirect=True) - if "shell" in kwargs and kwargs["shell"] is True: - # shell=True interferes with eric debugger - kwargs["shell"] = False + if ( + "shell" in kwargs + and kwargs["shell"] is True + and not os.path.isabs(args_list[0]) + ): + prog = shutil.which(args_list[0]) + if prog: + args_list[0] = prog + args = patchArguments( + _debugClient, + args_list, + noRedirect=True, + isPythonProg=isPythonProg, + ) + if "shell" in kwargs and kwargs["shell"] is True: + args = shlex.join(args) super().__init__(args, *popenargs, **kwargs)