#if TOOLS using Godot; using Rokojori; using System.Diagnostics; using System.Collections.Generic; using System.Threading.Tasks; namespace Rokojori.Tools { public class GitResponse { public string rawResponse; public int exitCode; } public class Git { public static async Task GetStatus( string path ) { var process = new Process { StartInfo = new ProcessStartInfo { FileName = "git", Arguments = "status", RedirectStandardOutput = true, RedirectStandardError = true, UseShellExecute = false, CreateNoWindow = true, WorkingDirectory = path } }; process.Start(); var outputTask = process.StandardOutput.ReadToEndAsync(); var errorTask = process.StandardError.ReadToEndAsync(); await Task.WhenAll( outputTask, errorTask ); await process.WaitForExitAsync(); var response = new GitResponse(); response.exitCode = process.ExitCode; if ( process.ExitCode == 0 ) { response.rawResponse = outputTask.Result; } else { response.rawResponse = errorTask.Result; } return response; } } } #endif