Skip to content

Conversation

@davidfowl
Copy link
Member

Description

Please include a summary of the changes and the related issue. Please also include relevant motivation and context. List any dependencies that are required for this change.

Fixes # (issue)

Checklist

  • Is this feature complete?
    • Yes. Ready to ship.
    • No. Follow-up changes expected.
  • Are you including unit tests for the changes and scenario tests if relevant?
    • Yes
    • No
  • Did you add public API?
    • Yes
      • If yes, did you have an API Review for it?
        • Yes
        • No
      • Did you add <remarks /> and <code /> elements on your triple slash comments?
        • Yes
        • No
    • No
  • Does the change make any security assumptions or guarantees?
    • Yes
      • If yes, have you done a threat model and had a security review?
        • Yes
        • No
    • No
  • Does the change require an update in our Aspire docs?

@github-actions
Copy link
Contributor

github-actions bot commented Dec 13, 2025

🚀 Dogfood this PR with:

⚠️ WARNING: Do not do this without first carefully reviewing the code of this PR to satisfy yourself it is safe.

curl -fsSL https://raw.githubusercontent.com/dotnet/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- 13549

Or

  • Run remotely in PowerShell:
iex "& { $(irm https://raw.githubusercontent.com/dotnet/aspire/main/eng/scripts/get-aspire-cli-pr.ps1) } 13549"

- Added `ICommandLineParser` interface for parsing command-line strings.
- Introduced `IExecutableResolver` interface to resolve executable paths using PATH and PATHEXT.
- Created `IProcessRunner` interface for executing processes directly.
- Implemented `ExecutableResolver` to handle executable resolution logic.
- Developed `ProcessRunner` for running processes and managing their input/output.
- Added `StreamRun` class for advanced process control, including output streaming and stdin handling.
- Created `ShellState` to represent the state of the virtual shell, including working directory and environment variables.
- Implemented `VirtualShell` class for executing commands without invoking a shell.
- Added extension methods for dependency injection to register VirtualShell services.
- Introduced `OutputLine` struct to represent lines of output from processes.
- Implemented `Stdin` and `StdoutTarget` classes for managing standard input and output.
- Created `StderrTarget` class for handling standard error output.

Refactor process execution to use VirtualShell

- Introduced IVirtualShell interface to abstract process execution.
- Replaced direct process execution with VirtualShell in DotnetSdkUtils and PackageFetcher.
- Implemented FakeVirtualShell for testing, capturing commands and allowing configurable responses.
- Updated tests to utilize FakeVirtualShell instead of MockProcessRunner.
- Added IStreamRun interface for advanced process control, including streaming output and stdin interaction.

Refactor command execution to streamline output handling and improve logging

Refactor VirtualShell API to use fluent command configuration and enhance command execution capabilities

Refactor ExecutableResolver to utilize PathLookupHelper for path resolution and streamline path extension handling

Add EnsureSuccess method to CliResultExtensions and enhance FakeVirtualShell with command state management

Refactor DcpHost to improve DCP process management and logging

Refactor command execution methods to use RunAsync instead of ExecuteAsync and introduce IRunningProcess for better process control

Refactor PythonVersionDetector to use IVirtualShell for process execution and update methods to async

Refactor IVirtualShell and ICommand interfaces to use RunAsync and Start methods for improved process execution and streamline output handling

Add examples for PATH manipulation, environment configuration, working directory, and process management in Virtual Shell API documentation

Remove ExitCodeAsync method from IRunningProcess interface and its implementations for streamlined process result handling

Enhance signal handling in ProcessRunner for Windows and Unix platforms, adding support for CTRL+C and CTRL+BREAK in .NET 10+ and improving graceful shutdown behavior.

Refactor cancellation handling by removing CancellationMode and related methods for streamlined process management

Rename Lines and ResultAsync methods to ReadLines and WaitAsync for improved clarity and consistency in IRunningProcess interface and implementations

Add disposal checks and enforce single invocation for ReadLines in IRunningProcess implementations

Remove Timeout method and related timeout properties from IVirtualShell and its implementations for simplified interface and usage.

Add support for secrets and structured logging in IVirtualShell and implementations

- Introduced DefineSecret, Secret, and SecretEnv methods for managing secret values.
- Implemented WithLogging method to enable structured logging for command execution.
- Enhanced Command and VirtualShell classes to handle secrets and logging.
- Added VirtualShellActivitySource for tracing command execution.
- Updated FakeVirtualShell to support secret management.

Enhance IVirtualShell with logging and diagnostics support for improved command tracking

Refactor IVirtualShell to remove timeout handling and simplify command execution; update documentation for new usage patterns and process lifecycle behavior.

Refactor DcpDependencyCheck and PythonVersionDetector to use CancellationTokenSource for timeout handling; simplify command execution and improve cancellation support.

Optimize command logging and diagnostics in Command class; build redacted command string only when necessary to improve performance and reduce unnecessary allocations.

Refactor FakeVirtualShell and RunningProcess to remove timeout handling; simplify command execution and improve process exit handling with async support.

Add PathLookupHelper to project references and suppress CS0436 warning for multiple assembly compilation

feat: Introduce VirtualShell for command execution without a shell

- Added StdoutTarget for capturing and streaming stdout data.
- Implemented VirtualShell class for portable command execution.
- Created VirtualShellActivitySource for tracing and diagnostics.
- Added extension methods for dependency injection of VirtualShell services.
- Updated ContainerRuntimeBase, DockerContainerRuntime, PodmanContainerRuntime, and ResourceContainerImageManager to use the new Execution namespace.
- Refactored tests to utilize the new VirtualShell implementation, including integration tests for real command execution.
- Introduced FakeVirtualShell for testing command execution in isolation.
- Added RequiresUnixSystemAttribute for conditional test execution on Unix systems.

refactor: Rename Run methods to RunAsync for consistency and clarity in IVirtualShell interface and implementations

refactor: Update Run methods to RunAsync for consistency in Docker-related classes

Refactor IVirtualShell and related classes to use ProcessResult instead of CliResult

- Updated IVirtualShell interface to return ProcessResult in RunAsync methods.
- Modified IProcessRunner and ProcessRunner to handle ProcessResult.
- Introduced ProcessExitReason and ProcessResult classes to encapsulate process execution results.
- Enhanced RunningProcess to utilize PipeWriter and PipeReader for better I/O handling.
- Updated Stdin to support manual pipe writing.
- Refactored tests to accommodate changes in result types and ensure compatibility with new ProcessResult structure.
- Added extension methods for RunningProcess to facilitate reading lines and writing to stdin.
- Marked several classes and methods as experimental for future enhancements.

refactor: Remove MaxCaptureBytes from Command and related classes for simplification

refactor: Remove ASPIREHOSTINGVIRTUALSHELL001 warning suppression across multiple files for improved clarity

refactor: Revise VirtualShell documentation for clarity and structure
- Renamed `RunningProcessExtensions` to `ProcessPipesExtensions` and updated method signatures to use `IProcessPipes`.
- Removed the `Stdin` class and replaced its usage with `ProcessInput`.
- Updated `VirtualShell` to streamline command creation and execution, removing redundant command line parsing.
- Modified various classes to utilize the new command structure, ensuring consistency across the codebase.
- Enhanced test cases to reflect changes in command execution methods, ensuring robust coverage for new implementations.
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