I'm trying to process log file output and put it on the plot. However, I can't put my hands around Get-Content -Wait. It seems that my C# program is not being invoked at all. Works fine without the wait switch, but that's not what I need. Simple sample:
using static System.Console;
public class Program
{
public static void Main(string[] args)
{
WriteLine("Starting...");
if (IsInputRedirected)
{
while (In.Peek() != -1)
{
Write("[");
var input = In.ReadLine();
WriteLine($"{input}]");
}
WriteLine("... done.");
}
else
{
WriteLine("Nothing");
}
}
}
With the sample calls like:
gc .\Program.cs | .\bin\Debug.ConsoleTest.exe
and
gc .\Program.cs -Wait | .\bin\Debug.ConsoleTest.exe
Does anybody know how to receive the output of Get-Content with -Wait from console application?