Repository: microsoft/ptvsd

Issue:
Jython - Internal error detected.
@kostermw commented on [Sat Dec 15 2018](https://github.com/Microsoft/vscode-python/issues/3715)

<!-- 
Do you have a question instead of a bug report or enhancement request? Please ask it on https://stackoverflow.com/questions/tagged/visual-studio-code+python. 

Unable to install a linter or formatter? 'No installers available'? 
Windows - https://stackoverflow.com/questions/4750806/how-do-i-install-pip-on-windows
Linux - https://www.cyberciti.biz/faq/debian-ubuntu-centos-rhel-linux-install-pipclient/ , https://www.tecmint.com/install-pip-in-linux/

Python configuration issues? Please check https://code.visualstudio.com/docs/python/python-tutorial#_prerequisites

Otherwise **please** fill in the requested details below. "XXX" markers should not be present in the final bug report.

If you think a GIF of what is happening would be helpful, consider tools like https://www.cockos.com/licecap/, https://github.com/phw/peek or https://www.screentogif.com/ .
-->

## Environment data

- VS Code version: 1.30.0
- Extension version (available under the Extensions sidebar): 2018.12.1
- OS and version: W10 Pro 1803 build 17134.471
- Python version (& distribution if applicable, e.g. Anaconda): Jython 2.7.0
- Type of virtual environment used (N/A | venv | virtualenv | conda | ...): N/A
- Relevant/affected Python packages and their versions: XXX

## Expected behaviour

XXX

## Actual behaviour

XXX

## Steps to reproduce:
1. debugging hello world example

## Logs
Output for `Python` in the `Output` panel (`View`→`Output`, change the drop-down the upper-right of the `Output` panel to `Python`)

```
XXX
```   

Output from `Console` under the `Developer Tools` panel (toggle Developer Tools on under `Help`)

```
PS D:\Users\koste\vs\hello> cd 'd:\Users\koste\vs\hello'; ${env:PYTHONIOENCODING}='UTF-8'; ${env:PYTHONUNBUFFERED}='1'; & 'C:\jython2.7.0\bin\jython.exe' 'd:\Users\koste\.vscode\extensions\ms-python.python-2018.12.1\pythonFiles\ptvsd_launcher.py' '--default' '--client' '--host' 'localhost' '--port' '51023' 'd:\Users\koste\vs\hello\hello.py'
Traceback (most recent call last):
  File "d:\Users\koste\.vscode\extensions\ms-python.python-2018.12.1\pythonFiles\ptvsd_launcher.py", line 21, in <module>
    import ptvsd
  File "d:\Users\koste\.vscode\extensions\ms-python.python-2018.12.1\pythonFiles\ptvsd_launcher.py", line 21, in <module>
    import ptvsd
  File "d:\Users\koste\.vscode\extensions\ms-python.python-2018.12.1\pythonFiles\lib\python\ptvsd\__init__.py", line 15, in <module>
    from ptvsd.attach_server import (
  File "d:\Users\koste\.vscode\extensions\ms-python.python-2018.12.1\pythonFiles\lib\python\ptvsd\attach_server.py", line 5, in <module>
    from ptvsd._remote import (
  File "d:\Users\koste\.vscode\extensions\ms-python.python-2018.12.1\pythonFiles\lib\python\ptvsd\_remote.py", line 11, in <module>
    from ptvsd.pydevd_hooks import install
  File "d:\Users\koste\.vscode\extensions\ms-python.python-2018.12.1\pythonFiles\lib\python\ptvsd\pydevd_hooks.py", line 15, in <module>
    from ptvsd.daemon import Daemon, DaemonStoppedError, DaemonClosedError
  File "d:\Users\koste\.vscode\extensions\ms-python.python-2018.12.1\pythonFiles\lib\python\ptvsd\daemon.py", line 12, in <module>
    from .exit_handlers import (
  File "d:\Users\koste\.vscode\extensions\ms-python.python-2018.12.1\pythonFiles\lib\python\ptvsd\exit_handlers.py", line 28, in <module>
    class ExitHandlers(object):
  File "d:\Users\koste\.vscode\extensions\ms-python.python-2018.12.1\pythonFiles\lib\python\ptvsd\exit_handlers.py", line 36, in ExitHandlers
    SIGNALS = [
AttributeError: 'module' object has no attribute 'SIGHUP'

Internal error detected. Please copy the above traceback and report at
https://github.com/Microsoft/vscode-python/issues/new
```


---

@kostermw commented on [Sat Dec 15 2018](https://github.com/Microsoft/vscode-python/issues/3715#issuecomment-447572774)

Reported as requested 




Discussion:
Interesting. Same error for IronPython: https://github.com/Microsoft/ptvsd/issues/436

Resolving patch:
diff --git a/src/ptvsd/exit_handlers.py b/src/ptvsd/exit_handlers.py
--- a/src/ptvsd/exit_handlers.py
+++ b/src/ptvsd/exit_handlers.py
@@ -28,7 +28,7 @@ def kill_current_proc(signum=signal.SIGTERM):
 class ExitHandlers(object):
     """Manages signal and atexit handlers."""
 
-    if platform.system() == 'Windows':
+    if platform.system() == 'Windows' or not hasattr(signal, 'SIGHUP'):
         # TODO: Windows *does* support these signals:
         #  SIGABRT, SIGFPE, SIGILL, SIGINT, SIGSEGV, SIGTERM, SIGBREAK
         SIGNALS = []


Test patch: