Skip to content

Commit d676b48

Browse files
committed
Again LSL Starting issue resolved
1 parent ff3e196 commit d676b48

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

app.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -202,10 +202,6 @@ def start_lsl():
202202
creation_flags = subprocess.CREATE_NO_WINDOW if sys.platform == "win32" else 0
203203
lsl_process = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, creationflags=creation_flags, text=True, bufsize=1)
204204

205-
monitor_thread = Thread(target=monitor_process_output, args=(lsl_process, "lsl"), daemon=True)
206-
monitor_thread.start()
207-
208-
time.sleep(2)
209205
output = lsl_process.stdout.readline().strip()
210206
if "No" in output:
211207
current_message = "Failed to start LSL stream"
@@ -214,6 +210,15 @@ def start_lsl():
214210
current_message = "LSL stream started successfully"
215211
lsl_running = True
216212

213+
if not lsl_running:
214+
current_message = "Failed to start LSL stream - no data detected"
215+
if lsl_process.poll() is None:
216+
lsl_process.terminate()
217+
return redirect(url_for('home'))
218+
219+
monitor_thread = Thread(target=monitor_process_output, args=(lsl_process, "lsl"), daemon=True)
220+
monitor_thread.start()
221+
217222
except Exception as e:
218223
current_message = f"Error starting LSL: {str(e)}"
219224
lsl_running = False

0 commit comments

Comments
 (0)