Skip to content

Commit 40b149a

Browse files
committed
Parse compiler messages properly on Windows
Currently SwiftPM dumps raw JSON data while compiling on Windows instead of the actual build status. After this change the compiler messages are parsed and displayed properly.
1 parent e2833bd commit 40b149a

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

Sources/TSCUtility/JSONMessageStreamingParser.swift

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,11 @@ private extension JSONMessageStreamingParser {
101101

102102
/// Throwing implementation of the parse function.
103103
func parseImpl<C>(bytes: C) throws where C: Collection, C.Element == UInt8 {
104+
#if os(Windows)
105+
let carriageReturn = UInt8(ascii: "\r")
106+
let bytes = bytes.filter { $0 != carriageReturn }
107+
#endif
108+
104109
switch state {
105110
case .parsingMessageSize:
106111
if let newlineIndex = bytes.firstIndex(of: newline) {

0 commit comments

Comments
 (0)