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

Wait until disconnect request is received and replied to when debugee terminates #134

Merged
merged 4 commits into from
Feb 28, 2018
Merged

Wait until disconnect request is received and replied to when debugee terminates #134

merged 4 commits into from
Feb 28, 2018

Conversation

DonJayamanne
Copy link
Contributor

@DonJayamanne DonJayamanne commented Feb 27, 2018

Fixes #120
Fixes #130
This has a dependency on #129

@@ -507,7 +514,15 @@ def on_configurationDone(self, request, args):

def on_disconnect(self, request, args):
# TODO: docstring
self.send_response(request)
if self.start_reason == 'launch':
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think terminateDebuggee argument should be handled here as well.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

terminateDebuggee

We're not supporting that are we?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should handle that as a separate PR, that's a new feature (new capability that we need to expose and I don't see that being exposed in on_initialize

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

VS supports 'Detach' from a launched application. See #86. We can handle that in a separate change, if it is not necessary for VSC.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Created a separate issue for that #136

@@ -413,6 +415,11 @@ def close(self):
self.send_event('exited', exitCode=ptvsd_sys_exit_code)
self.send_event('terminated')

self.disconnect_request_event.wait(WAIT_FOR_DISCONNECT_REQUEST_TIMEOUT)
if self.disconnect_request is not None:
Copy link
Member

@karthiknadig karthiknadig Feb 27, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if self.disconnect_request_event.isSet(): do we need disconnect_request ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not following you.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I updated the comment. I think the event state is enough to determine if there was a disconnect request.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I misunderstood this part ignore my comment.

@karthiknadig
Copy link
Member

This fixes #28

ptvsd/wrapper.py Outdated
self.send_response(request)
if self.start_reason == 'launch':
self.disconnect_request_event.set()
self.disconnect_request = request
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should assign the field first, then set the event.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh yes, bug, thanks

ptvsd/wrapper.py Outdated
self.disconnect_request = request
killProcess = not self._closed
self.close()
if killProcess:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why does the process need to kill itself like that?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sys.exit(0), doesn't kill the process. it just runs it to completion.
E.g. if I were to add a breakpoint in a loop, and then stop the debugger (sys.exit(0) at this point doesn't end the loop/process, basically the program continues)

@DonJayamanne
Copy link
Contributor Author

Please could someone merge this for me.
@int19h can I get the rights to the into this repo.

@karthiknadig
Copy link
Member

@DonJayamanne looks like there are some merge conflicts. Let me know when you are done resolving them.

@DonJayamanne
Copy link
Contributor Author

Easy, will do tonight.
Before we merge this we need to merge #129 (dependent code)

@DonJayamanne
Copy link
Contributor Author

done, merge issues resolved.

@DonJayamanne DonJayamanne merged commit c797626 into microsoft:master Feb 28, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants