in src/Aspire.Hosting.AWS/Utils/Internal/ProcessCommandService.cs [121:169]
public int RunProcess(ILogger logger, string path, string arguments, string workingDirectory)
{
using var process = new Process
{
StartInfo = new ProcessStartInfo
{
WorkingDirectory = workingDirectory,
FileName = path,
Arguments = arguments,
RedirectStandardOutput = true,
RedirectStandardError = true,
UseShellExecute = false,
WindowStyle = ProcessWindowStyle.Hidden
}
};
var output = new StringBuilder();
process.OutputDataReceived += (sender, e) =>
{
if (e.Data != null)
{
output.Append(e.Data);
}
};
process.ErrorDataReceived += (sender, e) =>
{
if (e.Data != null)
{
output.Append(e.Data);
}
};
process.Start();
process.BeginOutputReadLine();
process.BeginErrorReadLine();
process.WaitForExit(int.MaxValue);
logger.LogDebug(output.ToString());
if (process.ExitCode != 0)
{
logger.LogDebug("Process {process} exited with code {exitCode}.", path, process.ExitCode);
}
return process.ExitCode;
}