Browse Source

Refactore process util (#812)

pull/827/head
Marvin Huber 6 years ago
committed by GitHub
parent
commit
bb49c16164
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 40
      src/Microsoft.Tye.Core/ProcessUtil.cs

40
src/Microsoft.Tye.Core/ProcessUtil.cs

@ -66,32 +66,36 @@ namespace Microsoft.Tye
var outputBuilder = new StringBuilder();
process.OutputDataReceived += (_, e) =>
{
if (e.Data != null)
if (e.Data == null)
{
if (outputDataReceived != null)
{
outputDataReceived.Invoke(e.Data);
}
else
{
outputBuilder.AppendLine(e.Data);
}
return;
}
if (outputDataReceived != null)
{
outputDataReceived.Invoke(e.Data);
}
else
{
outputBuilder.AppendLine(e.Data);
}
};
var errorBuilder = new StringBuilder();
process.ErrorDataReceived += (_, e) =>
{
if (e.Data != null)
if (e.Data == null)
{
if (errorDataReceived != null)
{
errorDataReceived.Invoke(e.Data);
}
else
{
errorBuilder.AppendLine(e.Data);
}
return;
}
if (errorDataReceived != null)
{
errorDataReceived.Invoke(e.Data);
}
else
{
errorBuilder.AppendLine(e.Data);
}
};

Loading…
Cancel
Save