Skip to content

Add RunAndCaptureAsync to DotNetRunBuilder #80

Description

@StevenTCramer

Problem

DotNetRunBuilder supports RunAsync and CaptureAsync, but does not appear to support RunAndCaptureAsync.

This creates a gap compared with Shell.Builder("dotnet") for interactive CLI workflows that need both:

  • live streamed output while the command runs
  • captured output/result details for failure reporting

Concrete use case

In timewarp-jaribu, tools/dev-cli/endpoints/test-command.cs runs the CI-safe runfile test runner:

CommandOutput result = await Shell.Builder("dotnet")
  .WithArguments
  (
    "run",
    ciTestRunner,
    "/p:ExperimentalFileBasedProgramEnableTransitiveDirectives=true"
  )
  .WithWorkingDirectory(RepoRoot)
  .WithNoValidation()
  .RunAndCaptureAsync(Ct);

We refactored workflow-command.cs to use typed builders such as DotNet.Clean, DotNet.Build, DotNet.Run().WithFile(...), and DotNet.Pack, but left test-command.cs on Shell.Builder("dotnet") because DotNet.Run() cannot currently preserve the same behavior.

CaptureAsync would capture silently and lose live progress output. RunAsync would stream output but lose captured details such as result.Combined and result.Success.

Requested API

Add RunAndCaptureAsync(CancellationToken) support to DotNetRunBuilder, matching the behavior available from ShellBuilder and other typed command builders where applicable.

Expected benefit

This would allow projects to consistently use typed DotNet.* builders for dotnet run commands, including .NET 10 file-based app/runfile execution via WithFile(...), without sacrificing interactive CLI UX or error reporting.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions