Skip to content

Elevation follow-ups: fix overload ambiguity, tests, README, CA2025#8

Merged
matt-edmondson merged 1 commit into
mainfrom
claude/elevation-followups
May 13, 2026
Merged

Elevation follow-ups: fix overload ambiguity, tests, README, CA2025#8
matt-edmondson merged 1 commit into
mainfrom
claude/elevation-followups

Conversation

@matt-edmondson
Copy link
Copy Markdown
Contributor

Summary

Follow-ups to #7 (elevation support):

  • Fix overload ambiguityExecuteAsync(string) called ExecuteAsync(command, new()), which is ambiguous between ExecuteAsync(string, OutputHandler) and ExecuteAsync(string, Elevation) since new() can target-type to either. Qualified as new OutputHandler().
  • Clear CA2025 — inlined Task.WhenAll(outputReader.Start(), process.WaitForExitAsync()) so the analyzer can see all tasks using the Process are awaited before its using disposes it.
  • Tests — added overload coverage for Execute/ExecuteAsync with Elevation.Default and Elevation.Elevated. The Elevated cases are Assert.Inconclusive on Windows to avoid blocking CI on a UAC prompt; on Linux/macOS they exercise the documented no-op path.
  • README — new "Elevation (Windows)" section, updated API Reference, and documented the Elevation enum values plus the output-capture caveat.

Test plan

  • CI runs dotnet test on Linux and the new elevation tests pass.
  • Manual: on Windows, RunCommand.Execute("whoami /groups", Elevation.Elevated) produces a UAC prompt and exits 0.
  • Manual: on Windows with Elevation.Elevated + an OutputHandler, confirm the handler is not invoked (documented behavior).
  • Verify README renders correctly on GitHub.

Generated by Claude Code

- Fix overload-resolution ambiguity in ExecuteAsync(string): new() was
  ambiguous between OutputHandler and Elevation, so qualify it as
  new OutputHandler().
- Inline Task.WhenAll over outputReader.Start() and process.WaitForExitAsync()
  to clear CA2025 (tasks using IDisposable instances must complete before
  disposal).
- Add tests for the new Elevation overloads, skipping Elevated on Windows
  to avoid blocking on a UAC prompt.
- Document the Elevation enum and its Windows-only behavior in the README,
  including the output-capture caveat.
@matt-edmondson matt-edmondson merged commit 5caae1d into main May 13, 2026
1 check passed
@matt-edmondson matt-edmondson deleted the claude/elevation-followups branch May 13, 2026 04:35
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.

2 participants