# std.Build.Step.Compile: fix race condition in args file creation · gitcafe/zig

[View on GitCafe](https://git.cafe/gitcafe/zig/commit/628357eeb6fd017bd374e3eff3a3c506244559d9)

Repository: [gitcafe/zig](https://git.cafe/gitcafe/zig)

Visibility: public

Requested revision: 628357eeb6fd017bd374e3eff3a3c506244559d9

Requested commit: 628357eeb6fd017bd374e3eff3a3c506244559d9

Commit: 628357eeb6fd017bd374e3eff3a3c506244559d9

Tree: 64ab4cc6d2d2cd9f3dbb343a78489825a72b2474

Author: Ian Johnson

Committer: Alex Rønne Petersen

## Message

```
std.Build.Step.Compile: fix race condition in args file creation

Fixes #23993

Previously, if multiple build processes tried to create the same args file, there was a race condition with the use of the non-atomic `writeFile` function which could cause a spawned compiler to read an empty or incomplete args file. This commit avoids the race condition by first writing to a temporary file with a random path and renaming it to the desired path.

```

## Parents

- [caa89c7601bba7520bae0e295cce1b7db896041c](https://git.cafe/gitcafe/zig/commit/caa89c7601bba7520bae0e295cce1b7db896041c?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zig/tree/628357eeb6fd017bd374e3eff3a3c506244559d9?format=markdown)
