Skip to content

Commit 06ec943

Browse files
committed
StdlibUnittest: add a workaround for Windows \r\n
Windows uses carriage returns and newlines. The string matching is sensitive to this. Simply erase carriage returns from the standard error stream to compensate.
1 parent b36c77c commit 06ec943

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

stdlib/private/StdlibUnittest/StdlibUnittest.swift

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -928,7 +928,10 @@ class _ParentProcess {
928928
let (_, stderrThread) = _stdlib_thread_create_block({
929929
while !self._childStderr.isEOF {
930930
self._childStderr.read()
931-
while let line = self._childStderr.getline() {
931+
while var line = self._childStderr.getline() {
932+
if let cr = line.firstIndex(of: "\r") {
933+
line.remove(at: cr)
934+
}
932935
var done: Bool
933936
(done: done, ()) = onStderrLine(line)
934937
if done { return }

0 commit comments

Comments
 (0)