fix make run daemon lifecycle
test / unit + widget + golden + a11y (push) Failing after 40s
test / integration_test (xvfb) (push) Has been skipped
test / bundle smoke (xvfb 5s) (push) Has been skipped
test / daemon subprocess + web WASM smoke (push) Has been skipped

Kill stale daemon before build to prevent "Text file busy". Trap
EXIT + INT + TERM for reliable cleanup on ctrl-C. Add make stop
for standalone daemon kill.

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2026-04-22 16:32:11 +02:00
co-authored by Claude
parent 5869697297
commit 861fa6652a
+9 -6
View File
@@ -40,21 +40,24 @@ endif
.PHONY: run
run: ## Build the daemon + launch the Flutter desktop app.
ifeq ($(APP_PRESENT),yes)
@# Build the CLI/daemon binary if stale.
@# Kill any stale daemon so the binary isn't locked.
@pkill -f 'bin/clide --daemon' 2>/dev/null; sleep 0.2; true
$(MAKE) build
@# Start daemon in background, then launch app.
@echo "Starting daemon…"
@bin/clide --daemon &
@DAEMON_PID=$$!; \
trap 'kill $$DAEMON_PID 2>/dev/null' EXIT; \
@bin/clide --daemon & DAEMON_PID=$$!; \
trap 'kill $$DAEMON_PID 2>/dev/null; wait $$DAEMON_PID 2>/dev/null' EXIT INT TERM; \
echo "Daemon PID $$DAEMON_PID"; \
echo "Launching Flutter app…"; \
cd app && flutter run -d linux; \
kill $$DAEMON_PID 2>/dev/null || true
kill $$DAEMON_PID 2>/dev/null; wait $$DAEMON_PID 2>/dev/null; true
else
@echo "(pubspec.yaml not scaffolded yet; skipping)"
endif
.PHONY: stop
stop: ## Kill any running clide daemon.
@pkill -f 'bin/clide --daemon' 2>/dev/null && echo "daemon stopped" || echo "no daemon running"
.PHONY: install
install: build ## Install bin/clide into $(INSTALL_DIR).
ifeq ($(APP_PRESENT),yes)