feat(proc): add cross-platform process and port inspection tool#28
Open
nooscraft wants to merge 2 commits into
Open
feat(proc): add cross-platform process and port inspection tool#28nooscraft wants to merge 2 commits into
nooscraft wants to merge 2 commits into
Conversation
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.
Summary
ut procwith six subcommands:list,name,pid,port,ports, andkill/proc/net/tcp), macOS (lsof), and Windows (netstat) with no extra dependencies beyondsysinfokillsends SIGTERM by default (graceful) or SIGKILL with--force; on Windows both map to a hard killlistandportsrender as proper columnar tables; all commands support--jsonfor machine-readable outputChanges
src/tools/proc.rs— new toolsrc/tool.rs— newOutput::Tablevariant that renders a JSON array as a columnar table in human mode and as JSON with--jsonCargo.toml— addssysinfo v0.39, enablespreserve_orderonserde_jsonso table column order is deterministicREADME.md— documents the new toolTest plan
ut proc listrenders a columnar tableut proc list --name node --cmdshows full command line as extra columnut proc list --name nodeshows nocmdcolumn without the flagut proc pid $$returns details for the current shellut proc portsshows no duplicate rowsut proc port <port>finds the owning process (startut serve --port 9999first)ut proc port <unused>returns a clear errorut proc kill --port <port>terminates the process (startut serve --port 9999first)ut proc kill --pid <pid>terminates by PIDut --json proc listreturns a valid JSON arraycargo test procpasses all 8 tests