diff --git a/Sources/Build/BuildOperationBuildSystemDelegateHandler.swift b/Sources/Build/BuildOperationBuildSystemDelegateHandler.swift index 5ec977c23f7..61d268f8597 100644 --- a/Sources/Build/BuildOperationBuildSystemDelegateHandler.swift +++ b/Sources/Build/BuildOperationBuildSystemDelegateHandler.swift @@ -773,7 +773,7 @@ final class BuildOperationBuildSystemDelegateHandler: LLBuildBuildSystemDelegate self.progressAnimation.clear() } - self.outputStream <<< output + self.outputStream <<< output <<< "\n" self.outputStream.flush() // next we want to try and scoop out any errors from the output (if reasonable size, otherwise this will be very slow), diff --git a/Tests/CommandsTests/BuildToolTests.swift b/Tests/CommandsTests/BuildToolTests.swift index ed7314143d9..5cbbdbcc433 100644 --- a/Tests/CommandsTests/BuildToolTests.swift +++ b/Tests/CommandsTests/BuildToolTests.swift @@ -390,4 +390,13 @@ final class BuildToolTests: CommandsTestCase { XCTAssertMatch(output, .prefix("digraph Jobs {")) } } + + func testSwiftDriverRawOutputGetsNewlines() throws { + try fixture(name: "DependencyResolution/Internal/Simple") { fixturePath in + // Building with `-wmo` should result in a `remark: Incremental compilation has been disabled: it is not compatible with whole module optimization` message, which should have a trailing newline. + let result = try execute(["-c", "release", "-Xswiftc", "-wmo"], packagePath: fixturePath) + XCTAssertMatch(result.stdout, .contains("optimization\n[")) + XCTAssertNoMatch(result.stdout, .contains("optimization[")) + } + } }