Rework how we edit processes so tests pass and it fixes the bug

This commit is contained in:
Timothy Baldridge 2021-07-15 15:03:59 -06:00
parent 1adf4b78b0
commit 4f4d8c487b

View File

@ -80,9 +80,10 @@ namespace Wabbajack.Common
}; };
p.ErrorDataReceived += ErrorEventHandler; p.ErrorDataReceived += ErrorEventHandler;
p.Start();
p.BeginErrorReadLine(); p.BeginErrorReadLine();
p.BeginOutputReadLine(); p.BeginOutputReadLine();
p.Start();
ChildProcessTracker.AddProcess(p); ChildProcessTracker.AddProcess(p);
@ -97,6 +98,8 @@ namespace Wabbajack.Common
var result = await finished.Task; var result = await finished.Task;
// Do this to make sure everything flushes
p.WaitForExit();
p.CancelErrorRead(); p.CancelErrorRead();
p.CancelOutputRead(); p.CancelOutputRead();
p.OutputDataReceived -= OutputDataReceived; p.OutputDataReceived -= OutputDataReceived;