Alquimiaware.NuGetUnity.NuGetCommand.CallNuGet C# (CSharp) Method

CallNuGet() protected method

Calls nuget, blocks until completion and returns output.
protected CallNuGet ( string args ) : string
args string nuget.exe args to be passed
return string
        protected string CallNuGet(string args)
        {
            UnityEngine.Debug.Log(args);
            var nugetFullPath = Directory.GetFiles(
                this.dataPath,
                "nuget.exe",
                SearchOption.AllDirectories)[0];

            var startInfo = new ProcessStartInfo(nugetFullPath, args);
            startInfo.RedirectStandardOutput = true;
            startInfo.RedirectStandardError = true;
            startInfo.UseShellExecute = false;
            startInfo.CreateNoWindow = true;

            var process = Process.Start(startInfo);
            var stdOut = process.StandardOutput.ReadToEnd();
            var stdError = process.StandardError.ReadToEnd();

            string output = !string.IsNullOrEmpty(stdOut) ? stdOut : stdError;

            UnityEngine.Debug.Log(output);

            return output;
        }