Skip to content

Commit

Permalink
Write output-file-map.json atomically
Browse files Browse the repository at this point in the history
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
  • Loading branch information
ahoppen committed Mar 19, 2024
1 parent 8268caa commit f9d3e99
Showing 1 changed file with 2 additions and 1 deletion.
Expand Up @@ -779,7 +779,8 @@ package final class SwiftTargetBuildDescription {

content += "}\n"

try self.fileSystem.writeFileContents(path, string: content)
try fileSystem.createDirectory(path.parentDirectory, recursive: true)
try self.fileSystem.writeFileContents(path, bytes: .init(encodingAsUTF8: content), atomically: true)
return path
}

Expand Down

0 comments on commit f9d3e99

Please sign in to comment.