mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Updates from PyDev.Debugger: refix attaching to subprocess with Popen on Windows (PY-20476, PY-22904)
This commit is contained in:
@@ -21,15 +21,17 @@ def log_error_once(msg):
|
||||
|
||||
pydev_src_dir = os.path.dirname(os.path.dirname(__file__))
|
||||
|
||||
def _get_python_c_args(host, port, indC, args):
|
||||
|
||||
def _get_python_c_args(host, port, indC, args, setup):
|
||||
host_literal = "'" + host + "'" if host is not None else 'None'
|
||||
return ("import sys; sys.path.append(r'%s'); import pydevd; "
|
||||
"pydevd.settrace(host=%s, port=%s, suspend=False, trace_only_current_thread=False, patch_multiprocessing=True); "
|
||||
"%s"
|
||||
"from pydevd import SetupHolder; SetupHolder.setup = %s; %s"
|
||||
) % (
|
||||
pydev_src_dir,
|
||||
host_literal,
|
||||
port,
|
||||
setup,
|
||||
args[indC + 1])
|
||||
|
||||
def _get_host_port():
|
||||
@@ -96,6 +98,7 @@ def patch_args(args):
|
||||
log_debug("Patching args: %s"% str(args))
|
||||
args = remove_quotes_from_args(args)
|
||||
|
||||
from pydevd import SetupHolder
|
||||
import sys
|
||||
new_args = []
|
||||
i = 0
|
||||
@@ -113,7 +116,7 @@ def patch_args(args):
|
||||
|
||||
if port is not None:
|
||||
new_args.extend(args)
|
||||
new_args[indC + 1] = _get_python_c_args(host, port, indC, args)
|
||||
new_args[indC + 1] = _get_python_c_args(host, port, indC, args, SetupHolder.setup)
|
||||
return quote_args(new_args)
|
||||
else:
|
||||
# Check for Python ZIP Applications and don't patch the args for them.
|
||||
@@ -147,7 +150,6 @@ def patch_args(args):
|
||||
# ['X:\\pysrc\\pydevd.py', '--multiprocess', '--print-in-debugger-startup',
|
||||
# '--vm_type', 'python', '--client', '127.0.0.1', '--port', '56352', '--file', 'x:\\snippet1.py']
|
||||
from _pydevd_bundle.pydevd_command_line_handling import setup_to_argv
|
||||
from pydevd import SetupHolder
|
||||
original = setup_to_argv(SetupHolder.setup) + ['--file']
|
||||
while i < len(args):
|
||||
if args[i] == '-m':
|
||||
|
||||
Reference in New Issue
Block a user