Piping output was mentioned in dotnet/sdk#4362 and marked as complete but the current implementation has issues. I wonder why we're piping at all and not just letting the child process take over the launching process' output.
Create a console app with the following and run it using dotnet run:
``` c#
using System;
namespace ConsolePipeBroken
{
public class Program
{
public static void Main(string[] args)
{
Console.Write("Type: ");
ConsoleKeyInfo inputChar;
while (inputChar.Key != ConsoleKey.Enter)
{
inputChar = Console.ReadKey();
Console.Write(inputChar.KeyChar.ToString());
}
Console.WriteLine();
Console.WriteLine("Enter key pressed, exiting");
}
}
}
```
You see "Type: " printed then as you type chars they appear in the console window. When you hit 'Enter' the exit line is printed and the process exits.
You see nothing printed when the app runs, you start typing chars and nothing appears until you hit 'Enter' at which point the entire console output is printed and the process exits.
dotnet --version output:
.NET Command Line Tools (1.0.0-beta-001898)
Product Information:
Version: 1.0.0-beta-001898
Commit Sha: 43ac2b45f4
Runtime Environment:
OS Name: Windows
OS Version: 10.0.10586
OS Platform: Windows
Runtime Id: win10-x64
I'm seeing this too. This makes it difficult to test interactive console apps with dotnet run and impossible to make a tool extension.
@piotrpMSFT @blackdwarf can we please get this looked at for the next tools preview. This is making it impossible to use dotnet run when writing interactive console applications, like project tools.
I suggest we revisit the entire idea of piping at all and just let the app write direct to the console.
I believe this was fixed in https://github.com/dotnet/cli/pull/3808 and https://github.com/dotnet/cli/pull/3013
This seems like it was fixed in the latest (Preview 3) bits, so I'm going to close. The repro specified above by @DamianEdwards works now as it should. If still repros, please reopen.
Most helpful comment
@piotrpMSFT @blackdwarf can we please get this looked at for the next tools preview. This is making it impossible to use
dotnet runwhen writing interactive console applications, like project tools.I suggest we revisit the entire idea of piping at all and just let the app write direct to the console.