Skip to content

Commit 720a7eb

Browse files
authored
Merge pull request #230 from Unity-Technologies/UNI-30753-dcc-install-misleading-error-dialog
UNI-30753 redirect stderror for installation processes, print any errors
2 parents 340babd + 7e04c2c commit 720a7eb

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

Assets/FbxExporters/Editor/InstallIntegration.cs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -352,6 +352,7 @@ public int ConfigureMaya(string mayaPath)
352352
myProcess.StartInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;
353353
myProcess.StartInfo.CreateNoWindow = true;
354354
myProcess.StartInfo.UseShellExecute = false;
355+
myProcess.StartInfo.RedirectStandardError = true;
355356

356357
string commandString;
357358

@@ -386,6 +387,14 @@ public int ConfigureMaya(string mayaPath)
386387
ExitCode = myProcess.ExitCode;
387388
Debug.Log(string.Format("Ran maya: [{0}]\nWith args [{1}]\nResult {2}",
388389
mayaPath, myProcess.StartInfo.Arguments, ExitCode));
390+
391+
// see if we got any error messages
392+
if(ExitCode != 0){
393+
string stderr = myProcess.StandardError.ReadToEnd();
394+
if(!string.IsNullOrEmpty(stderr)){
395+
Debug.LogError(string.Format("Maya installation error (exit code: {0}): {1}", ExitCode, stderr));
396+
}
397+
}
389398
}
390399
else
391400
{
@@ -625,6 +634,7 @@ public static int InstallMaxPlugin(string maxExe){
625634
myProcess.StartInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;
626635
myProcess.StartInfo.CreateNoWindow = true;
627636
myProcess.StartInfo.UseShellExecute = false;
637+
myProcess.StartInfo.RedirectStandardOutput = true;
628638

629639
myProcess.StartInfo.Arguments = string.Format("-q -silent -mxs \"{0}\"", installScript);
630640

@@ -644,6 +654,14 @@ public static int InstallMaxPlugin(string maxExe){
644654
ExitCode = 0;
645655
}
646656

657+
// print any errors
658+
if(ExitCode != 0){
659+
string stderr = myProcess.StandardOutput.ReadToEnd();
660+
if(!string.IsNullOrEmpty(stderr)){
661+
Debug.LogError(string.Format("3ds Max installation error (exit code: {0}): {1}", ExitCode, stderr));
662+
}
663+
}
664+
647665
Debug.Log(string.Format("Ran max: [{0}]\nWith args [{1}]\nResult {2}",
648666
maxExe, myProcess.StartInfo.Arguments, ExitCode));
649667
}

0 commit comments

Comments
 (0)