Skip to content

Commit 3be4320

Browse files
committed
CLIConnection tests: close output stream on shutdown
Noticed this during a bit of investigation into swiftlang#21, and don't necessarily expect this to fix it, but it seems correct in order to prevent the fd possibly being closed while the stream is still being read.
1 parent de925c6 commit 3be4320

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

Tests/SwiftBuildTests/ConsoleCommands/CLIConnection.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,10 @@ final class CLIConnection {
151151
_ = try? await exitStatus
152152
}
153153

154+
// Consume the rest of the output before closing the handle to ensure the dispatch IO is closed
155+
while let _ = try? await outputStreamIterator.next() {
156+
}
157+
154158
try? monitorHandle.close()
155159
}
156160

0 commit comments

Comments
 (0)