public static GitOutput Execute(GitInput input) { Verify.Argument.IsNotNull(input, "input"); var stdOutReader = new AsyncTextReader(); var stdErrReader = new AsyncTextReader(); var executor = new GitProcessExecutor(GitExePath); var exitCode = executor.Execute(input, stdOutReader, stdErrReader); return new GitOutput( stdOutReader.GetText(), stdErrReader.GetText(), exitCode); }
public static Version CheckVersion(string gitExe) { var stdErrReceiver = new AsyncTextReader(); var stdOutReceiver = new AsyncTextReader(); var executor = new GitProcessExecutor(gitExe); var exitCode = executor.Execute(new GitInput(new Command("--version")), stdOutReceiver, stdErrReceiver); var output = new GitOutput(stdOutReceiver.GetText(), stdErrReceiver.GetText(), exitCode); output.ThrowOnBadReturnCode(); var parser = new GitParser(output.Output); return parser.ReadVersion(); }