WIP
This commit is contained in:
24
test_socket.py
Executable file
24
test_socket.py
Executable file
@@ -0,0 +1,24 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
import socket
|
||||
from time import sleep
|
||||
|
||||
from rich.console import Console
|
||||
|
||||
console = Console()
|
||||
print = console.print
|
||||
|
||||
with socket.socket(socket.AF_UNIX, socket.SOCK_STREAM) as sock:
|
||||
try:
|
||||
sock.connect('/run/example.sock')
|
||||
except Exception:
|
||||
raise
|
||||
else:
|
||||
with console.status('Connected...'):
|
||||
while True:
|
||||
try:
|
||||
sleep(0.1)
|
||||
except KeyboardInterrupt:
|
||||
break
|
||||
finally:
|
||||
print('Exiting')
|
||||
Reference in New Issue
Block a user