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

Exit on SIGHUP signal #129

Merged
merged 5 commits into from
Feb 28, 2018
Merged

Exit on SIGHUP signal #129

merged 5 commits into from
Feb 28, 2018

Conversation

DonJayamanne
Copy link
Contributor

Fixes #128

ptvsd/wrapper.py Outdated
@@ -943,6 +944,10 @@ def start_server(port):
client, _ = server.accept()
pydevd, proc, _ = _start(client, server)
atexit.register(proc.close)
def signal_handler(signum, frame):
Copy link
Contributor

Choose a reason for hiding this comment

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

Since this gets repeated, I'd rather have it as a separate function that is wired up through a lambda here (so that we don't have multiple places to update in the future).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Do you mean something like this:

def signal_handler(signum, frame, proc):
    proc.close()
    sys.exit(0)

...
def start_server(port):
...
    signal.signal(signal.SIGHUP, lambda signum, frame: signal_handler(signum, frame, proc))

@DonJayamanne
Copy link
Contributor Author

DonJayamanne commented Feb 28, 2018

@int19h I've address you'd like your comments. Please check again

@int19h
Copy link
Contributor

int19h commented Feb 28, 2018

Good to go as soon as merge conflicts are resolved.

@DonJayamanne
Copy link
Contributor Author

Done.

@DonJayamanne DonJayamanne merged commit 5db5cf6 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.

2 participants