Bug 8013 - mono prints escape sequences ^[[1;1R^[[1;8R even when stdout is not the standard output
Summary: mono prints escape sequences ^[[1;1R^[[1;8R even when stdout is not the stand...
Status: NEW
Alias: None
Product: Class Libraries
Classification: Mono
Component: mscorlib (show other bugs)
Version: unspecified
Hardware: PC Linux
: --- normal
Target Milestone: Untriaged
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2012-10-26 04:25 UTC by aakashrc
Modified: 2017-07-13 00:20 UTC (History)
4 users (show)

See Also:
Tags:
Is this bug a regression?: ---
Last known good build:


Attachments

Description aakashrc 2012-10-26 04:25:11 UTC
When I am executing a mono program with expect script, garbage cursur output is being printed on the screen.
Following is the C# source code that I am executing:

========================================================

using System;
 
public class HelloWorld
{
    static public void Main ()
    {
      	string lineTC = Console.ReadLine();
 	int numTc=0;
      	if (int.TryParse(lineTC, out numTc)) 
		{
          	for(int i = 0; i < numTc; i++)
            {
              	string line = Console.ReadLine();
              	int num=0;
              	if(int.TryParse(line, out num))
                {
                  	Console.WriteLine(isPrime(num));
                }
            }
	}
    }
    static private int isPrime(int num)
    {
    	int i=2;
    	for(;i<=num/2;i++)
    	{           
        	if(num%i == 0)          
        	{                       
            	return 0;                           
        	}                       
    	}           
    	return 1;   
    }
}

=============================================================

Following is the expect script code:

#!/usr/bin/expect

spawn mono submission.exe
send "10\n"
send "2\n"
expect "1\n"
send "111\n"
expect "0\n"
send "100001\n"
expect "0\n"
send "111111\n"
expect "0\n"
send "786431\n"
expect "1\n"
send "10000007\n"
expect "0\n"
send "1442968193\n"
expect "1\n"
send "2147483647\n"
expect "1\n"
send "999999000001\n"
send "1111111111111111111\n"

interact

================================================================

The output from expect is as follows:
./exp.exp 
spawn mono submission.exe
10
2
1
111
0
100001
0
111111
0
786431
1
^[[1;1R^[[1;8R1
^[[2;1R111
0
^[[4;1R100001
0
^[[6;1R111111
0
^[[8;1R786431
1
^[[10;1R10000007
0
^[[12;1R1442968193
1
^[[14;1R2147483647
1
^[[16;1R999999000001
Comment 1 Rodrigo Kumpera 2017-07-13 00:20:42 UTC
This is a BCL bug in the console driver.

Note You need to log in before you can comment on or make changes to this bug.