-
-
Save mrkane27/b1d8fe9de43810591aac to your computer and use it in GitHub Desktop.
console_width_test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
console_width_test.cs: | |
using System; | |
class console_width_test { | |
public static void Main() { | |
Console.WriteLine( | |
String.Format( | |
"WindowWidth={0}, IsOutputRedirected={1}, IsErrorRedirected={2}, IsInputRedirected={3}", | |
Console.WindowWidth, | |
Console.IsOutputRedirected, | |
Console.IsErrorRedirected, | |
Console.IsInputRedirected)); | |
} | |
} | |
Mono on Linux | |
vlad@vlad-xu1404:~/Desktop$ ./console_width_test.exe | |
WindowWidth=138, IsOutputRedirected=False, IsErrorRedirected=False, IsInputRedirected=False | |
vlad@vlad-xu1404:~/Desktop$ echo | ./console_width_test.exe | |
WindowWidth=0, IsOutputRedirected=False, IsErrorRedirected=False, IsInputRedirected=True | |
vlad@vlad-xu1404:~/Desktop$ ./console_width_test.exe | cat | |
WindowWidth=0, IsOutputRedirected=True, IsErrorRedirected=False, IsInputRedirected=False | |
vlad@vlad-xu1404:~/Desktop$ ./console_width_test.exe 2>/dev/null | |
WindowWidth=138, IsOutputRedirected=False, IsErrorRedirected=True, IsInputRedirected=False | |
vlad@vlad-xu1404:~/Desktop$ ./console_width_test.exe >/tmp/bla && cat /tmp/bla && rm /tmp/bla | |
WindowWidth=0, IsOutputRedirected=True, IsErrorRedirected=False, IsInputRedirected=False | |
vlad@vlad-xu1404:~/Desktop$ echo | ./console_width_test.exe 2>/dev/null | |
WindowWidth=0, IsOutputRedirected=False, IsErrorRedirected=True, IsInputRedirected=True | |
.NET on Windows: | |
~/dev> ./console_width_test.exe | |
WindowWidth=240, IsOutputRedirected=False, IsErrorRedirected=False, IsInputRedirected=False | |
~/dev> echo | ./console_width_test.exe | |
WindowWidth=240, IsOutputRedirected=False, IsErrorRedirected=False, IsInputRedirected=True | |
~/dev> ./console_width_test.exe | cat | |
WindowWidth=240, IsOutputRedirected=True, IsErrorRedirected=False, IsInputRedirected=False | |
~/dev> ./console_width_test.exe >/tmp/bla && cat /tmp/bla && rm /tmp/bla | |
WindowWidth=240, IsOutputRedirected=True, IsErrorRedirected=False, IsInputRedirected=False | |
~/dev> echo | ./console_width_test.exe 2>/tmp/baz | |
WindowWidth=240, IsOutputRedirected=False, IsErrorRedirected=True, IsInputRedirected=True |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment