Process result displays incorrectly after reading in Mono

I seem to be running into what might be a bug in mono, or that Im doing something wrong.

I am using subprocesses to do things with C #, however in some situations the terminal breaks down not displaying the correct input Im. I managed to achieve this after using the console to read the line.

I'm currently on Mac using the Mono JIT compiler version 3.10.0 mono but don't know if this is monophonic or if it can happen on Windows.

The minimal code I was able to recreate is below:

using System;
using System.Diagnostics;

namespace Test
{
    class MainClass
    {
        public static void Main( string[] args )
        {
            Console.ReadLine();

            Process.Start("tee","text.txt").WaitForExit();            
        }
    }
}

      

If you remove the read line, the output from tee is printed after you type it (so you see the same line twice), but with the read line, it only displays the output from tee, not the input you are typing

IE: No read line

~/test $ mcs program.cs && mono program.exe
this 
this 
is 
is 
writting 
writting 
to 
to 
file 
file 
^C 

~/test $ cat text.txt 
this
is
writting
to
file

      

And with the line read

~/test $ mcs program.cs && mono program.exe
readline
this
should
be 
printing
as well

~/test $ cat text.txt
this
should
be 
printing
as well

      

+3


source to share





All Articles