Skip to content

Commit 397db74

Browse files
ahoppenfurby-tm
authored andcommitted
Write output-file-map.json atomically (swiftlang#7406)
There are two subtle changes in behavior here: - This call will fail if the file system doesn’t support atomic operations. I’m not sure if we need to support file systems that don’t allow atomic operations here. rdar://124727242
1 parent 42cbd23 commit 397db74

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

Sources/Build/BuildDescription/SwiftTargetBuildDescription.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -779,7 +779,8 @@ package final class SwiftTargetBuildDescription {
779779

780780
content += "}\n"
781781

782-
try self.fileSystem.writeFileContents(path, string: content)
782+
try fileSystem.createDirectory(path.parentDirectory, recursive: true)
783+
try self.fileSystem.writeFileContents(path, bytes: .init(encodingAsUTF8: content), atomically: true)
783784
return path
784785
}
785786

0 commit comments

Comments
 (0)