Repository navigation
kill: other users' pid-less rows are skipped, not failed - #17
Merged
Merged
Conversation
This was referenced Nov 3, 2026
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 #4.
ports kill <name>matches every row whose name fits, including other users' listeners. A scan without root sees those with pid 0, and nothing short ofsudocan stop them. Each one was reported as a failed stop, so a kill that stopped everything it could still exited 1. A script or agent runningports kill shop && …read that as "the stop didn't work".--dry-runwas worse: it claimed it "would stop" those rows and exited 0.Now, for
killonly:skipped: still reported, never hidden, each with the command that would stop it. That'ssudo systemctl stop <unit>for a named service,sudo ports free <port>otherwise, andports doctor <port>for a docker-proxy whose container didn't resolve, since sudo can't stop a proxy either.--expect. The guard judges only what would actually be stopped. A skipped row is never stopped, so it can't sink a guarded kill.ports free <port>is unchanged. You named that port outright, so failing to stop what holds it is a real failure there.How it was verified
Gate, locally with CI's versions: unit ✓, build ✓, integration ✓ (uncached), installers ✓, gofmt ✓, vet ✓, lint ✓ (v2.13.2).
Real binary on a machine with a root-owned listener on :2024 (seen as
?, pid 0). I started a python server on :8792 renamed?so thatkill '?'matches both:New tests:
TestStopAllSkipsUnowned: mixed rows, including a unit row and a docker-proxy row.TestStopAllOnlyUnownedExitsOne.TestStopAllExpectIgnoresSkipped.TestStopAllSkippedJSON.The existing
TestStopAllExpectFailsClosed(thefreepath) still refuses an anonymous row.Risk
Tier: risky (the kill path,
--json, exit codes).Can anything new be stopped? No.
inspect.Stopalready returned an error for every such row before signalling anything. Skipped rows never reach the stop call, and--expectstays all-or-nothing over the stoppable targets.Public surface:
kill's exit code goes from 1 to 0 when the only "failures" were unstoppable rows.--jsongains the action valueskipped. That's additive, and skipped results come after the others.kill --expectno longer refuses everything because of an unowned row.inspect.unownedis exported asUnowned, with the same body.Rollback: revert the squash commit. Nothing is persisted.
A fresh-context review said ok to ship, and confirmed nothing new can be stopped. Its three should-fixes are the second commit:
--expecthelp and docs said "every target", which isn't true forkillany more;sudo ports freehint that would fail again;Notes for the release
ports killskips other users' listeners it can't stop, with the command that would, instead of failing the whole kill. In--jsontheiractionisskipped.Generated by Claude Code