Skip to content
This repository has been archived by the owner on Aug 2, 2023. It is now read-only.

Commit

Permalink
Fix #325: Debuggee no longer terminates (#424)
Browse files Browse the repository at this point in the history
Terminate the process immediately instead of closing pydevd socket when disconnecting after launch.
  • Loading branch information
int19h authored May 21, 2018
1 parent 1ca7051 commit 38b6878
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 9 deletions.
1 change: 0 additions & 1 deletion ptvsd/_vendored/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,6 @@ def vendored(project, root=None):
try:
yield root
finally:
#del sys.path[0]
sys.path.remove(root)


Expand Down
13 changes: 12 additions & 1 deletion ptvsd/_vendored/force_pydevd.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from importlib import import_module
import warnings

from . import check_modules, prefix_matcher, preimport
from . import check_modules, prefix_matcher, preimport, vendored


# Ensure that pydevd is our vendored copy.
Expand All @@ -13,6 +14,16 @@
warnings.warn(msg + ':\n {}'.format('\n '.join(_unvendored)))


# Constants must be set before importing any other pydevd module
# # due to heavy use of "from" in them.
with vendored('pydevd'):
pydevd_constants = import_module('_pydevd_bundle.pydevd_constants')
# Disable this, since we aren't packaging the Cython modules at the moment.
pydevd_constants.CYTHON_SUPPORTED = False
# We limit representation size in our representation provider when needed.
pydevd_constants.MAXIMUM_VARIABLE_REPRESENTATION_SIZE = 2**32


# Now make sure all the top-level modules and packages in pydevd are
# loaded. Any pydevd modules that aren't loaded at this point, will
# be loaded using their parent package's __path__ (i.e. one of the
Expand Down
11 changes: 4 additions & 7 deletions ptvsd/wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,6 @@
import warnings
from xml.sax import SAXParseException

import _pydevd_bundle.pydevd_constants as pydevd_constants
# Disable this, since we aren't packaging the Cython modules at the moment.
pydevd_constants.CYTHON_SUPPORTED = False
# We limit representation size in our representation provider when needed.
pydevd_constants.MAXIMUM_VARIABLE_REPRESENTATION_SIZE = 2**32

import _pydevd_bundle.pydevd_comm as pydevd_comm # noqa
import _pydevd_bundle.pydevd_extension_api as pydevd_extapi # noqa
import _pydevd_bundle.pydevd_extension_utils as pydevd_extutil # noqa
Expand Down Expand Up @@ -67,6 +61,7 @@
supportsSetExpression=True,
supportsModulesRequest=True,
supportsLogPoints=True,
supportTerminateDebuggee=True,
exceptionBreakpointFilters=[
{
'filter': 'raised',
Expand Down Expand Up @@ -853,7 +848,9 @@ def _handle_disconnect(self, request):
self.disconnect_request_event.set()
self._notify_disconnecting(not self._closed)
if not self._closed:
self.close()
# Closing the socket causes pydevd to resume all threads,
# so just terminate the process altogether.
sys.exit(0)

def _wait_for_server_thread(self):
if self.server_thread is None:
Expand Down

0 comments on commit 38b6878

Please sign in to comment.