feat: stop a single browser by name - #108
Open
johan44co wants to merge 1 commit into
Open
Conversation
`Command::Stop` now takes an optional NAME positional argument. dev-browser stop # daemon-wide stop (unchanged) dev-browser stop <name> # stop just that browser, leave the daemon up The daemon's `browser-stop` IPC message and the corresponding `browserManager.stopBrowser(name)` method already existed and are covered by daemon tests; this just exposes them on the CLI. Stopping an unknown name is a silent no-op, matching the daemon's idempotent behavior. Motivated by the fact that there was previously no way to dispose a single managed browser without killing the daemon (and every other browser it manages), which makes timestamped or per-test `--browser` names accumulate forever in `dev-browser browsers`.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #107.
Summary
Adds an optional
NAMEpositional argument todev-browser stop:The daemon already implements
browser-stop(protocol.ts,daemon.ts,browserManager.stopBrowser); this just exposes it on the CLI. Stopping an unknown name is a silent no-op, matching the daemon's idempotent behavior.Why
Without this, any workflow that uses unique
--browsernames (e.g. timestamped names for test isolation) leaks an instance per run — there's no way to clean them up exceptdev-browser stop, which also kills every other browser. See #107 for a full reproducer.Diff
Single file, ~25 lines of Rust:
Command::Stop→Command::Stop { name: Option<String> }name:None→ existing{type: "stop"}flow (daemon kill)Some(name)→ new{type: "browser-stop", browser: name}flowNo daemon changes. No new dependencies.
Verification
Local CI checks pass:
cargo fmt -- --check,cargo check,cargo build.I left
CHANGELOG.mdalone since the maintainer manages versioning/release entries — happy to add an entry under anUnreleasedheading if preferred.