Repository navigation
chore: remove dead unused Process allocation in GetProcessCommandLine - #1004
Merged
shanselman merged 1 commit intoJul 17, 2026
Conversation
GetProcessCommandLine allocated `var result = new System.Diagnostics.Process()` that is never used — the method does its work through a separate `using var p = Process.Start(psi)`. Because `result` is never Start()ed it holds no OS handle, so this is dead code (an unused allocation), not a runtime leak. Remove it. Refs openclaw#1003.
1 task done
Contributor
Author
|
@clawsweeper review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
Contributor
Author
|
@clawsweeper review |
|
🦞👀 Command router queued. I will update this comment with the next step. |
anagnorisis2peripeteia
deleted the
fix/remove-dead-process-getprocesscommandline
branch
September 9, 2026 00:36
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.
Related: #1003
What Problem This Solves
This is a small code-quality cleanup, not a user-facing fix. While auditing the node's disposal paths,
SetupSteps.GetProcessCommandLinewas found to allocate aSystem.Diagnostics.Processit never uses:resultis assigned once and never read — the method does everything through the separate, properly-using'dp. It's a leftover. (It'sIDisposable, but since it's neverStart()ed it holds no OS handle, so this is dead code, not a resource leak.)Why This Change Was Made
Delete the unused
resultallocation; keep the// Use WMIcomment (it describes the actual query below it). No other change. Found withklammerkrebs, a RoslynIDisposableanalyzer (candidate surfaced by the tool, then confirmed by reading the method). Non-goal: the other candidates from the same audit are async-onlySemaphoreSlim/CTSfields that are correct left as-is — see #1003 for the analysis.User Impact
None.
GetProcessCommandLinebehaves identically; the removed variable was never used.Evidence
One-line deletion:
The project compiles clean after removal (proving
resultwas unreferenced), and the affected project's tests pass. Details in Validation below.Change Type
Scope
winnodeValidation
Validated on macOS (dotnet 10.0.302); the Windows-only required steps (
./build.ps1,Tray.Tests) and the full test matrix run on CI (windows-latest).The failures are pre-existing macOS-environment failures, not caused by this change: the 1 SetupEngine failure asserts a hardcoded Windows path (
...\OpenClawTrayvs macOSPath.Combine/) and fails identically on the un-patched base; the 28 Shared failures are all exec-approval / executable-resolution / argv / command tests that require Windows behavior. This change is a one-line deletion inOpenClaw.SetupEngineand cannot affectOpenClaw.Shared. All are green on the Windows CI matrix.Real Behavior Proof
windows-latest)4750440dotnet build+dotnet teston the affected project (above)resultwas the sole occurrence, so the deletion is behavior-preservingGetProcessCommandLinestill runs its query throughpN/A(no UI / no behavior change)./build.ps1and the Windows-only test suites are not runnable on macOS; covered by upstream CISecurity Impact
NoNoNoNo(the removed variable was never used; the actualProcess.Start(psi)is untouched)NoCompatibility and Migration
YesNoNoReview Conversations