File tree Expand file tree Collapse file tree 4 files changed +16
-6
lines changed Expand file tree Collapse file tree 4 files changed +16
-6
lines changed Original file line number Diff line number Diff line change @@ -39,7 +39,7 @@ class FormatFrontend: Frontend {
3939 return
4040 }
4141
42- var stdoutStream = FileHandle . standardOutput
42+ var stdoutStream = FileHandleTextOutputStream ( FileHandle . standardOutput)
4343 do {
4444 if inPlace {
4545 var buffer = " "
Original file line number Diff line number Diff line change 1212
1313import Foundation
1414
15- extension FileHandle : TextOutputStream {
16- public func write( _ string: String ) {
17- self . write ( string. data ( using: . utf8) !) // Conversion to UTF-8 cannot fail
15+ /// Wraps a `FileHandle` so that it can be used by APIs that take a `TextOutputStream`-conforming
16+ /// type as an input.
17+ struct FileHandleTextOutputStream : TextOutputStream {
18+ /// The underlying file handle to which the text will be written.
19+ private var fileHandle : FileHandle
20+
21+ /// Creates a new output stream that writes to the given file handle.
22+ init ( _ fileHandle: FileHandle ) {
23+ self . fileHandle = fileHandle
24+ }
25+
26+ func write( _ string: String ) {
27+ fileHandle. write ( string. data ( using: . utf8) !) // Conversion to UTF-8 cannot fail
1828 }
1929}
Original file line number Diff line number Diff line change @@ -64,7 +64,7 @@ final class StderrDiagnosticPrinter {
6464 /// Prints a diagnostic to standard error.
6565 func printDiagnostic( _ diagnostic: TSCBasic . Diagnostic ) {
6666 printQueue. sync {
67- let stderr = FileHandle . standardError
67+ let stderr = FileHandleTextOutputStream ( FileHandle . standardError)
6868
6969 stderr. write ( " \( ansiSGR ( . boldWhite) ) \( diagnostic. location) : " )
7070
Original file line number Diff line number Diff line change @@ -20,7 +20,7 @@ struct VersionOptions: ParsableArguments {
2020 func validate( ) throws {
2121 if version {
2222 // TODO: Automate updates to this somehow.
23- print ( " 0.50600.0 " )
23+ print ( " 0.50600.1 " )
2424 throw ExitCode . success
2525 }
2626 }
You can’t perform that action at this time.
0 commit comments