Skip to content

Commit 7c927fa

Browse files
committed
Write output-file-map.json atomically
There are two subtle changes in behavior here: - The old variant of `writeFileContents` went through a few abstraction layers in `FileSystem+Extensions.swift` that ended up calling `writeFileContents(_:body:)`, which also created the directories to the file. think we can assume that the parent directory already exists 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 8268caa commit 7c927fa

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Sources/Build/BuildDescription/SwiftTargetBuildDescription.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -779,7 +779,7 @@ package final class SwiftTargetBuildDescription {
779779

780780
content += "}\n"
781781

782-
try self.fileSystem.writeFileContents(path, string: content)
782+
try self.fileSystem.writeFileContents(path, bytes: .init(encodingAsUTF8: content), atomically: true)
783783
return path
784784
}
785785

0 commit comments

Comments
 (0)