mirror of
https://github.com/Tyrrrz/CliFx.git
synced 2025-10-25 15:19:17 +00:00
Use Stream.Synchronized
This commit is contained in:
@@ -94,15 +94,14 @@ namespace CliFx
|
|||||||
|
|
||||||
public partial class SystemConsole
|
public partial class SystemConsole
|
||||||
{
|
{
|
||||||
// TODO: use StreamWriter.Synchronized?
|
|
||||||
private static StreamReader WrapInput(Stream? stream) =>
|
private static StreamReader WrapInput(Stream? stream) =>
|
||||||
stream != null
|
stream != null
|
||||||
? new StreamReader(stream, Console.InputEncoding, false)
|
? new StreamReader(Stream.Synchronized(stream), Console.InputEncoding, false)
|
||||||
: StreamReader.Null;
|
: StreamReader.Null;
|
||||||
|
|
||||||
private static StreamWriter WrapOutput(Stream? stream) =>
|
private static StreamWriter WrapOutput(Stream? stream) =>
|
||||||
stream != null
|
stream != null
|
||||||
? new StreamWriter(stream, Console.OutputEncoding) {AutoFlush = true}
|
? new StreamWriter(Stream.Synchronized(stream), Console.OutputEncoding) {AutoFlush = true}
|
||||||
: StreamWriter.Null;
|
: StreamWriter.Null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -94,12 +94,12 @@ namespace CliFx
|
|||||||
{
|
{
|
||||||
private static StreamReader WrapInput(Stream? stream) =>
|
private static StreamReader WrapInput(Stream? stream) =>
|
||||||
stream != null
|
stream != null
|
||||||
? new StreamReader(stream, Console.InputEncoding, false)
|
? new StreamReader(Stream.Synchronized(stream), Console.InputEncoding, false)
|
||||||
: StreamReader.Null;
|
: StreamReader.Null;
|
||||||
|
|
||||||
private static StreamWriter WrapOutput(Stream? stream) =>
|
private static StreamWriter WrapOutput(Stream? stream) =>
|
||||||
stream != null
|
stream != null
|
||||||
? new StreamWriter(stream, Console.OutputEncoding) {AutoFlush = true}
|
? new StreamWriter(Stream.Synchronized(stream), Console.OutputEncoding) {AutoFlush = true}
|
||||||
: StreamWriter.Null;
|
: StreamWriter.Null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user