mirror of
https://github.com/spalencsar/bearhub.git
synced 2026-07-06 22:54:16 +02:00
14 lines
338 B
Python
14 lines
338 B
Python
import subprocess
|
|
import traceback
|
|
from subprocess import Popen
|
|
|
|
|
|
def is_available() -> bool:
|
|
try:
|
|
res = Popen(['ping', '-q', '-w1', '-c1', 'google.com'], stderr=subprocess.DEVNULL, stdout=subprocess.DEVNULL)
|
|
res.wait()
|
|
return res.returncode == 0
|
|
except:
|
|
traceback.print_exc()
|
|
return False
|