Skip to content

Commit

Permalink
Fixed occasionally passing null to StringBuilder.Append (#11)
Browse files Browse the repository at this point in the history
  • Loading branch information
jaredhefty authored and mysticmind committed Aug 30, 2019
1 parent 6f7470e commit 3768229
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions src/MysticMind.PostgresEmbed/Utils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -147,8 +147,17 @@ public static ProcessResult RunProcess(string filename, List<string> args)
p.StartInfo.RedirectStandardOutput = true;
p.StartInfo.UseShellExecute = false;
p.EnableRaisingEvents = true;
p.OutputDataReceived += (sender, e) => outputBuilder.Append(e.Data);
p.ErrorDataReceived += (sender, e) => errorBuilder.Append(e.Data);
p.OutputDataReceived += (sender, e) =>
{
if (!string.IsNullOrEmpty(e.Data))
outputBuilder.Append(e.Data);
};

p.ErrorDataReceived += (sender, e) =>
{
if (!string.IsNullOrEmpty(e.Data))
errorBuilder.Append(e.Data);
};

p.StartInfo.FileName = filename;
p.StartInfo.Arguments = string.Join(" ", args);
Expand Down

0 comments on commit 3768229

Please sign in to comment.