Skip to content

Commit e64a05c

Browse files
committed
redirect stderror for installation processes, print any errors
1 parent cd0309f commit e64a05c

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
@@ -345,6 +345,7 @@ public int ConfigureMaya(string mayaPath)
345345
myProcess.StartInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;
346346
myProcess.StartInfo.CreateNoWindow = true;
347347
myProcess.StartInfo.UseShellExecute = false;
348+
myProcess.StartInfo.RedirectStandardError = true;
348349

349350
string commandString;
350351

@@ -379,6 +380,14 @@ public int ConfigureMaya(string mayaPath)
379380
ExitCode = myProcess.ExitCode;
380381
Debug.Log(string.Format("Ran maya: [{0}]\nWith args [{1}]\nResult {2}",
381382
mayaPath, myProcess.StartInfo.Arguments, ExitCode));
383+
384+
// see if we got any error messages
385+
if(ExitCode != 0){
386+
string stderr = myProcess.StandardError.ReadToEnd();
387+
if(!string.IsNullOrEmpty(stderr)){
388+
Debug.LogError(string.Format("Maya installation error (exit code: {0}): {1}", ExitCode, stderr));
389+
}
390+
}
382391
}
383392
else
384393
{
@@ -618,6 +627,7 @@ public static int InstallMaxPlugin(string maxExe){
618627
myProcess.StartInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;
619628
myProcess.StartInfo.CreateNoWindow = true;
620629
myProcess.StartInfo.UseShellExecute = false;
630+
myProcess.StartInfo.RedirectStandardError = true;
621631

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

@@ -637,6 +647,14 @@ public static int InstallMaxPlugin(string maxExe){
637647
ExitCode = 0;
638648
}
639649

650+
// print any errors
651+
if(ExitCode != 0){
652+
string stderr = myProcess.StandardError.ReadToEnd();
653+
if(!string.IsNullOrEmpty(stderr)){
654+
Debug.LogError(string.Format("3ds Max installation error (exit code: {0}): {1}", ExitCode, stderr));
655+
}
656+
}
657+
640658
Debug.Log(string.Format("Ran max: [{0}]\nWith args [{1}]\nResult {2}",
641659
maxExe, myProcess.StartInfo.Arguments, ExitCode));
642660
}

0 commit comments

Comments
 (0)