Skip to content

Commit 0629fc4

Browse files
authored
Register for signals only when running in main thread (#1087)
1 parent dc15dc1 commit 0629fc4

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

proxy/proxy.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
import pprint
1515
import signal
1616
import logging
17+
import threading
1718
from typing import TYPE_CHECKING, Any, List, Optional, cast
1819

1920
from .core.ssh import SshTunnelListener, SshHttpProtocolHandler
@@ -255,7 +256,8 @@ def setup(self) -> None:
255256
('', self.flags.tunnel_remote_port),
256257
)
257258
# TODO: May be close listener fd as we don't need it now
258-
self._register_signals()
259+
if threading.current_thread() == threading.main_thread():
260+
self._register_signals()
259261

260262
def shutdown(self) -> None:
261263
if self.flags.enable_ssh_tunnel:

0 commit comments

Comments
 (0)