Skip to content

Commit 6e3bde7

Browse files
committed
Fix linux failures
1 parent fac2692 commit 6e3bde7

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

src/debugpy/adapter/clients.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,17 @@
66

77
import atexit
88
import os
9-
import socket
109
import sys
11-
from typing import Any, Literal, Union, cast
10+
from typing import TYPE_CHECKING, Any, Literal, Union, cast
1211

1312
import debugpy
1413
from debugpy import adapter, common, launcher
1514
from debugpy.common import json, log, messaging, sockets
1615
from debugpy.adapter import clients, components, launchers, servers, sessions
1716

17+
if TYPE_CHECKING:
18+
# socket can't be imported at runtime on linux, causes runtime issues.
19+
import socket
1820

1921
class Client(components.Component):
2022
"""Handles the client side of a debug session."""
@@ -43,7 +45,7 @@ class Expectations(components.Capabilities):
4345
"pathFormat": json.enum("path", optional=True), # we don't support "uri"
4446
}
4547

46-
def __init__(self, sock: Union[Literal["stdio"], socket.socket]):
48+
def __init__(self, sock: "Union[Literal[\"stdio\"], socket.socket]"):
4749
if sock == "stdio":
4850
log.info("Connecting to client over stdio...", self)
4951
self.using_stdio = True

0 commit comments

Comments
 (0)