Skip to content

Commit

Permalink
If no patching is required for subprocess, return original arguments. F…
Browse files Browse the repository at this point in the history
  • Loading branch information
fabioz committed Jun 3, 2020
1 parent 958af7e commit 2f62f79
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/debugpy/_vendored/pydevd/_pydev_bundle/pydev_monkey.py
Original file line number Diff line number Diff line change
Expand Up @@ -247,12 +247,13 @@ def patch_args(args, is_exec=False):
'''
try:
pydev_log.debug("Patching args: %s", args)
original_args = args
args = remove_quotes_from_args(args)

from pydevd import SetupHolder
new_args = []
if len(args) == 0:
return args
return original_args

if is_python(args[0]):
ind_c = get_c_option_index(args)
Expand Down Expand Up @@ -284,13 +285,13 @@ def patch_args(args, is_exec=False):
extensions = _get_str_type_compatible(arg, ['zip', 'pyz', 'pyzw'])
if arg.rsplit(dot)[-1] in extensions:
pydev_log.debug('Executing a PyZip, returning')
return args
return original_args
break

new_args.append(args[0])
else:
pydev_log.debug("Process is not python, returning.")
return args
return original_args

i = 1
# Original args should be something as:
Expand Down Expand Up @@ -323,7 +324,7 @@ def patch_args(args, is_exec=False):
# in practice it'd raise an exception here and would return original args, which is not what we want... providing
# a proper fix for https://youtrack.jetbrains.com/issue/PY-9767 elsewhere.
if i < len(args) and _is_managed_arg(args[i]): # no need to add pydevd twice
return args
return original_args

for x in original:
new_args.append(x)
Expand All @@ -340,7 +341,7 @@ def patch_args(args, is_exec=False):
return quote_args(new_args)
except:
pydev_log.exception('Error patching args')
return args
return original_args


def str_to_args_windows(args):
Expand Down
1 change: 1 addition & 0 deletions src/debugpy/_vendored/pydevd/pydevd.py
Original file line number Diff line number Diff line change
Expand Up @@ -2757,6 +2757,7 @@ def __init__(self, dispatcher):

ReaderThread.__init__(
self,
get_global_debugger(),
self.dispatcher.client,
PyDevJsonCommandProcessor=PyDevJsonCommandProcessor,
process_net_command=process_net_command,
Expand Down

0 comments on commit 2f62f79

Please sign in to comment.