Skip to content

Commit

Permalink
Name of method + Trying to make the tests to pass
Browse files Browse the repository at this point in the history
  • Loading branch information
MikaelMayer committed Feb 15, 2022
1 parent 69d341e commit c6c9e4f
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions Source/Dafny/Compilers/Compiler-js.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2378,12 +2378,14 @@ public override bool RunTargetProgram(string dafnyProgramName, string targetProg
return SendToNewNodeProcess(dafnyProgramName, targetProgramText, callToMain, targetFilename, otherFileNames, outputWriter);
}

DataReceivedEventHandler ProcessData(TextWriter writer) {
DataReceivedEventHandler GetEventHandlerFrom(TextWriter writer) {
return (sendingProcess, e) => {
if (!((Process)sendingProcess).HasExited) {
writer.WriteLine(e.Data);
} else {
writer.Write(e.Data);
if (e.Data != null) {
if (!((Process)sendingProcess).HasExited) {
writer.WriteLine(e.Data);
} else {
writer.Write(e.Data);
}
}
};
}
Expand All @@ -2402,8 +2404,8 @@ bool SendToNewNodeProcess(string dafnyProgramName, string targetProgramText, str

try {
Process nodeProcess = new Process { StartInfo = psi };
nodeProcess.OutputDataReceived += ProcessData(Console.Out);
nodeProcess.ErrorDataReceived += ProcessData(Console.Error);
nodeProcess.OutputDataReceived += GetEventHandlerFrom(Console.Out);
nodeProcess.ErrorDataReceived += GetEventHandlerFrom(Console.Error);
nodeProcess.Start();
nodeProcess.BeginOutputReadLine();
nodeProcess.BeginErrorReadLine();
Expand Down

0 comments on commit c6c9e4f

Please sign in to comment.