mirror of
https://github.com/RPCS3/discord-bot.git
synced 2026-01-31 01:25:22 +01:00
24 lines
732 B
C#
24 lines
732 B
C#
using System.Diagnostics;
|
|
|
|
namespace CompatBot.Utils;
|
|
|
|
public class GitRunner
|
|
{
|
|
public static async Task<string> Exec(string arguments, CancellationToken cancellationToken)
|
|
{
|
|
using var git = new Process
|
|
{
|
|
StartInfo = new("git", arguments)
|
|
{
|
|
CreateNoWindow = true,
|
|
UseShellExecute = false,
|
|
RedirectStandardOutput = true,
|
|
StandardOutputEncoding = Encoding.UTF8,
|
|
},
|
|
};
|
|
git.Start();
|
|
var stdout = await git.StandardOutput.ReadToEndAsync(cancellationToken).ConfigureAwait(false);
|
|
await git.WaitForExitAsync(cancellationToken).ConfigureAwait(false);
|
|
return stdout;
|
|
}
|
|
} |