eval scheme: fix few crashes caused by invalid json serialization

This commit is contained in:
Nicolò Balzarotti 2023-02-22 04:17:14 +01:00
parent 40c9655424
commit fcda05dfc6
1 changed files with 2 additions and 1 deletions

3
app.py
View File

@ -13,6 +13,7 @@ from sensors import sensors
import phasectrl import phasectrl
from time import perf_counter, sleep from time import perf_counter, sleep
from scm import stringify
def create_app(): def create_app():
app = Flask('hakkoso') app = Flask('hakkoso')
@ -91,7 +92,7 @@ def handle_new_client():
@socketio.on('eval scheme') @socketio.on('eval scheme')
def eval_scheme(code): def eval_scheme(code):
output = phasectrl.safe_eval(code, statemachine.env, notify=False) output = phasectrl.safe_eval(code, statemachine.env, notify=False)
socketio.emit('eval output', output) socketio.emit('eval output', stringify(output, quote=False))
@socketio.on('get sensors history') @socketio.on('get sensors history')
def send_sensors_history(elements=1000): def send_sensors_history(elements=1000):