mirror of https://git.48k.eu/ogclient
#1065 Avoid SIGPIPE errors in windows mode
SIGPIPE is only available on Unix. Add try/except so that this import does not crash ogclient when running in Windows mode. Only assign SIG_DFL handler to SIGPIPE when mode is not windows. Prefer signal.signal over signal alone to better distinguish module from function.more_events
parent
ab7abf96a6
commit
fd1f01d76b
12
ogclient
12
ogclient
|
@ -9,12 +9,18 @@
|
|||
# (at your option) any later version.
|
||||
|
||||
import json
|
||||
import logging
|
||||
import subprocess
|
||||
try:
|
||||
from signal import SIG_DFL, SIGPIPE
|
||||
except ImportError:
|
||||
from signal import SIG_DFL
|
||||
|
||||
|
||||
from src.ogClient import *
|
||||
from signal import signal, SIGPIPE, SIG_DFL
|
||||
|
||||
|
||||
def main():
|
||||
signal(SIGPIPE, SIG_DFL)
|
||||
config_path = f'{ogClient.OG_PATH}ogclient/cfg/ogclient.json'
|
||||
try:
|
||||
with open(config_path, 'r') as f:
|
||||
|
@ -27,6 +33,8 @@ def main():
|
|||
URL = CONFIG['opengnsys']['url']
|
||||
if MODE == 'live':
|
||||
proc = subprocess.Popen(["browser", "-qws", URL])
|
||||
if MODE != 'windows':
|
||||
signal.signal(SIGPIPE, SIG_DFL)
|
||||
|
||||
client = ogClient(config=CONFIG)
|
||||
client.connect()
|
||||
|
|
Loading…
Reference in New Issue