25 lines
526 B
Python
Executable File
25 lines
526 B
Python
Executable File
#!/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')
|