diff --git a/Source/Core/Compilers/NodesCompiler.cs b/Source/Core/Compilers/NodesCompiler.cs index 23140d9fcc0be7f91d7ff9eb6d81683021065226..33e70b35360c5653cfdd437a4f61438753b5f289 100755 --- a/Source/Core/Compilers/NodesCompiler.cs +++ b/Source/Core/Compilers/NodesCompiler.cs @@ -96,12 +96,23 @@ namespace CodeImp.DoomBuilder.Compilers General.WriteLogLine("Program: " + processinfo.FileName); General.WriteLogLine("Arguments: " + processinfo.Arguments); - Process process; + string outErr = ""; + string outMsg = ""; + + Process process = new Process(); + process.StartInfo = processinfo; + + // Redirect stdout and strerr, so that they can be analyzed. This has to be done asynchronously since the output can be + // very long, which would cause StandardOutput.ReadToEnd() and StandardError.ReadToEnd() to hang + process.OutputDataReceived += (object sender, DataReceivedEventArgs e) => outMsg += e.Data; + process.ErrorDataReceived += (object sender, DataReceivedEventArgs e) => outErr += e.Data; try { // Start the compiler - process = Process.Start(processinfo); + process.Start(); + process.BeginOutputReadLine(); + process.BeginErrorReadLine(); } catch(Exception e) { @@ -110,13 +121,13 @@ namespace CodeImp.DoomBuilder.Compilers return false; } - //mxd - string outErr = process.StandardError.ReadToEnd().Trim().Replace("\b", ""); - string outMsg = process.StandardOutput.ReadToEnd().Trim().Replace("\b", ""); - // Wait for compiler to complete process.WaitForExit(); + outErr = outErr.Trim().Replace("\b", ""); + outMsg = outMsg.Trim().Replace("\b", ""); + + //mxd bool errorsInNormalOurput = (outMsg.Length > 0 && outMsg.ToLowerInvariant().IndexOf("error") != -1); //zdbsp actually writes building process here, not error info