Class CommandExecutor
- Namespace
- Steeltoe.Common.Utils.Diagnostics
- Assembly
- Steeltoe.Common.Utils.dll
Supports all classes in the .NET class hierarchy and provides low-level services to derived classes. This is the ultimate base class of all .NET classes; it is the root of the type hierarchy.
[Obsolete("This feature will be removed in the next major version. See https://steeltoe.io/docs/v3/obsolete for details.")]
public class CommandExecutor : ICommandExecutor
- Inheritance
-
CommandExecutor
- Implements
- Inherited Members
Constructors
CommandExecutor(ILogger<CommandExecutor>)
Initializes a new instance of the CommandExecutor class.
public CommandExecutor(ILogger<CommandExecutor> logger = null)
Parameters
loggerILogger<CommandExecutor>Injected logger.
Methods
ExecuteAsync(string, string, int)
Execute the command and return the result.
public Task<CommandResult> ExecuteAsync(string command, string workingDirectory = null, int timeout = -1)
Parameters
commandstringCommand to be executed.
workingDirectorystringThe directory that contains the command process.
timeoutintThe amount of time in milliseconds to wait for command to complete.
Returns
- Task<CommandResult>
Command result.
Exceptions
- CommandException
If a process can not be started for command.