public static void Execute(string command, EventHandler endedHandler = null) { if (!IsGitInstalled) { Debug.LogError("GIT is not installed on this system, Please install git"); return; } Process process = new System.Diagnostics.Process(); ProcessStartInfo startInfo = new System.Diagnostics.ProcessStartInfo(); startInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden; startInfo.CreateNoWindow = true; startInfo.FileName = "git"; startInfo.Arguments = command; startInfo.RedirectStandardOutput = true; startInfo.RedirectStandardError = true; startInfo.UseShellExecute = false; process.OutputDataReceived += (sender, args) => { UPMConsole.Log(args.Data); }; process.ErrorDataReceived += (sender, args) => { UPMConsole.Log(args.Data); }; if (endedHandler != null) { process.Exited += endedHandler; } process.StartInfo = startInfo; process.Start(); process.BeginOutputReadLine(); process.BeginErrorReadLine(); }
public static void PullPackage(Repository repoToPull) { GitCommand.Execute("clone " + repoToPull.PackageURL + " " + MODULES_PATH + repoToPull.PackageName, (e, args) => { UPMConsole.Log( "Package downloaded"); AssetDatabase.Refresh(); }); }