Class CommandExecutorBase
Base class for command executors that provides shared process execution logic. Subclasses implement PrepareProcessStartInfo(string, string[], CommandOptions) to customize command setup.
public abstract class CommandExecutorBase : ICommandExecutor
- Inheritance
-
CommandExecutorBase
- Implements
- Derived
- Inherited Members
Constructors
CommandExecutorBase(IBuildLogger)
protected CommandExecutorBase(IBuildLogger logger)
Parameters
loggerIBuildLogger
Fields
Logger
protected readonly IBuildLogger Logger
Field Value
Methods
ExecuteAsync(string, string[], CommandOptions?)
Executes a command with real-time output streaming. Output is streamed to the logger as it's produced by the command.
public Task<CommandResult> ExecuteAsync(string command, string[] args, CommandOptions? options = null)
Parameters
commandstringThe command to execute (e.g., "dotnet")
argsstring[]Command arguments
optionsCommandOptionsOptional execution options
Returns
- Task<CommandResult>
Result containing exit code and success status
IsAvailable(string)
Checks if a command/tool is available in the execution environment. Used to provide helpful error messages before attempting execution.
public abstract bool IsAvailable(string command)
Parameters
commandstring
Returns
LogCommand(string, string[], CommandOptions)
Logs the command being executed for debugging and troubleshooting. This helps users see exactly what commands are run and reproduce issues.
protected virtual void LogCommand(string command, string[] args, CommandOptions options)
Parameters
commandstringargsstring[]optionsCommandOptions
PrepareProcessStartInfo(string, string[], CommandOptions)
Prepares the ProcessStartInfo for command execution. Subclasses override this to customize the command setup (e.g., wrapping in docker exec).
protected abstract ProcessStartInfo PrepareProcessStartInfo(string command, string[] args, CommandOptions options)
Parameters
commandstringargsstring[]optionsCommandOptions