Cake.Web.Core.NuGet.NuGetInstaller.ExecuteNuget C# (CSharp) Метод

ExecuteNuget() приватный статический Метод

private static ExecuteNuget ( FilePath nugetToolPath, string arguments, string fallbackarguments, int retries ) : void
nugetToolPath FilePath
arguments string
fallbackarguments string
retries int
Результат void
        private static void ExecuteNuget(FilePath nugetToolPath, string arguments, string fallbackarguments, int retries)
        {
            while (true)
            {
                var process = Process.Start(new ProcessStartInfo(nugetToolPath.FullPath, arguments) {UseShellExecute = false});
                if (process == null)
                {
                    throw new NullReferenceException(nameof(process));
                }

                bool timeout;
                if ((timeout = !process.WaitForExit(45000)) && !process.HasExited)
                {
                    process.Kill();
                }

                if (!timeout && process.ExitCode == 0)
                {
                    return;
                }

                if (--retries <= 0)
                {
                    throw new InvalidOperationException($"Failed to install package ({arguments})");
                }

                arguments = fallbackarguments;
            }
        }