Skip to content

feat(viewer): closing the viewer window terminates the CLI - #168

Merged
zackees merged 1 commit into
mainfrom
feat/viewer-close-exits-cli
Jun 12, 2026
Merged

zackees merged 1 commit into
mainfrom
feat/viewer-close-exits-cli

Conversation

@zackees

@zackees zackees commented Jun 12, 2026

Copy link
Copy Markdown
Member

Summary

  • Add a non-blocking ViewerProcess::is_alive() probe: WaitForSingleObject(handle, 0) on Windows, SpawnedChild::try_wait() on POSIX (reap-safe — group kill-on-drop is best-effort killpg).
  • Normal sketch mode: the watch loop checks viewer liveness on its existing 1s tick and shuts down cleanly (exit 0) when the window closes; in-flight compiles always finish first.
  • --serve-dir: replaced the bare ctrl_c().await with a tokio::select! over Ctrl+C and a 1s liveness poll.
  • --internal-serve-dir-headless: unchanged (no viewer ever constructed); the new serve_dir_request() dispatch function + tests assert the headless path never launches a viewer.
  • Viewer crash and user close are treated identically (exit 0). Ctrl+C and space-bar rebuild behavior unchanged.

Closes #167

Test plan

  • soldr cargo test --workspace — 148 passed (new: liveness alive→dead probe tests on both Windows and POSIX cfgs, 3 serve_dir_request dispatch tests)
  • soldr cargo fmt --all -- --check clean
  • soldr cargo clippy --workspace --all-targets clean
  • uv run pytest tests/unit — 18 passed

🤖 Generated with Claude Code

Add a non-blocking ViewerProcess::is_alive() probe (WaitForSingleObject
on Windows, SpawnedChild::try_wait on POSIX) and treat viewer exit as a
clean shutdown signal: the normal sketch watch loop checks liveness each
1s tick, and --serve-dir selects over Ctrl+C and a 1s liveness poll.
Headless serve (--internal-serve-dir-headless) is unchanged — it never
constructs a ViewerProcess, asserted via the new serve_dir_request()
dispatch tests. Viewer crash and user close are treated identically and
exit 0; in-flight compiles always finish before shutdown.

Closes #167

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@zackees
zackees merged commit 68ee09a into main Jun 12, 2026
25 checks passed
@zackees
zackees deleted the feat/viewer-close-exits-cli branch June 12, 2026 03:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(viewer): closing the Tauri viewer window should terminate the fastled CLI (except headless serve)

1 participant