waypipe: only supported on Linux

This commit is contained in:
Jörg Thalheim
2024-12-07 08:17:50 +01:00
committed by Mic92
parent b36f07057a
commit 6310fc12fb

View File

@@ -1,4 +1,5 @@
import contextlib import contextlib
import platform
import socket import socket
import subprocess import subprocess
import time import time
@@ -11,6 +12,9 @@ VMADDR_CID_HYPERVISOR = 2
def test_vsock_port(port: int) -> bool: def test_vsock_port(port: int) -> bool:
if platform.system() != "Linux":
msg = "vsock is only supported on Linux"
raise NotImplementedError(msg)
try: try:
s = socket.socket(socket.AF_VSOCK, socket.SOCK_STREAM) s = socket.socket(socket.AF_VSOCK, socket.SOCK_STREAM)
s.connect((VMADDR_CID_HYPERVISOR, port)) s.connect((VMADDR_CID_HYPERVISOR, port))