Last active
January 19, 2025 19:03
-
-
Save Samasaur1/fc0ac732bde806f5b7d84d6b71d7e20f to your computer and use it in GitHub Desktop.
Revisions
-
Samasaur1 revised this gist
Jan 19, 2025 . 1 changed file with 3 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -14,4 +14,6 @@ internal struct FileHandleOutputStream: TextOutputStream { } } internal var STDERR = FileHandleOutputStream(.standardError) internal var STDOUT = FileHandleOutputStream(.standardOutput) print("Hello, world!, to: &STDERR) -
Samasaur1 created this gist
Jan 19, 2025 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,17 @@ internal struct FileHandleOutputStream: TextOutputStream { private let fileHandle: FileHandle let encoding: String.Encoding init(_ fileHandle: FileHandle, encoding: String.Encoding = .utf8) { self.fileHandle = fileHandle self.encoding = encoding } mutating func write(_ string: String) { if let data = string.data(using: encoding) { fileHandle.write(data) } } } internal var STDERR = FileHandleOutputStream(.standardError) internal var STDOUT = FileHandleOutputStream(.standardOutput)