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

PVSD should kill process when SIGHUP event is received #128

Closed
DonJayamanne opened this issue Feb 27, 2018 · 3 comments
Closed

PVSD should kill process when SIGHUP event is received #128

DonJayamanne opened this issue Feb 27, 2018 · 3 comments

Comments

@DonJayamanne
Copy link
Contributor

@brettcannon @int19h @karthiknadig

  • Debug a program with an input statement
  • Program waits for user input
  • Kill terminal

Observed behaviour:

  • Socket connection in debug adapter throws an exception
  • The debug adapter (VS Code) reacts to this error and terminates the debug session
  • Part of this includes killing the python process and manually sending the termainted event

Proposed solution

  • As the program is launched for debugging we can handle the SIGHUP signal from PTVSD and send the terminated event from within and exit the process.

The reason I'm proposing this is because its better for PTVSD to send messages directly to VS Code where possible (avoid need for VS Code adapter to do the dirty work of figuring out when to send terminated events, etc).

@karthiknadig how does VS handle such situations (closing terminal)?
Is this where you too are handling the error and close events of the socket connection?

@int19h
Copy link
Contributor

int19h commented Feb 27, 2018

Wait, SIGHUP doesn't run atexit handlers?

@int19h
Copy link
Contributor

int19h commented Feb 27, 2018

Also, I think the answer for VS would be that it doesn't get into such situations, because Windows doesn't have SIGHUP. I guess there's still a question of what remote debugging from VS would do, but I don't think we've ever tried that.

@DonJayamanne
Copy link
Contributor Author

because Windows doesn't have SIGHUP

Aaah yes, it doesn't have ANY signals.

Wait, SIGHUP doesn't run atexit handlers?

Nope, from what I've read atexit handlers don't work for most signals.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants