tools: tuhi-live's tuhi server needs to ignore SIGINT

Handling SIGINT in the freshly-started server leads to a race condition:
on Ctrl+C, Tuhi is killed before tuhi-live can call StopLive, leaving the
device in live mode. On the next start of tuhi-live nothing works because the
device will complain about invalid state.

Simplest solution here is to ignore SIGINT in the Tuhi instance and instead
rely on python's multiprocessing module to take us down when the main process
exits.

Fixes #206

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
pull/210/head
Peter Hutterer 2019-08-29 12:24:19 +10:00
parent b6fc384b66
commit f118b52862
1 changed files with 6 additions and 0 deletions

View File

@ -56,6 +56,12 @@ def maybe_start_tuhi(queue):
sys.path.append(os.getcwd())
import tuhi.base
import signal
# we don't want to kill Tuhi on ctrl+c because we won't be able to reset
# live mode. Instead we rely on tuhi-live to take us down when it exits
signal.signal(signal.SIGINT, signal.SIG_IGN)
args = ['tuhi-live'] # argparse in tuhi.base.main skips argv[0]
if verbose:
args.append('--verbose')