| ... | ... | @@ -1827,7 +1827,26 @@ fn getZigArgs(compile: *Compile, fuzz: bool) ![][]const u8 { |
| 1827 | 1827 | _ = try std.fmt.bufPrint(&args_hex_hash, "{x}", .{&args_hash}); |
| 1828 | 1828 | |
| 1829 | 1829 | const args_file = "args" ++ fs.path.sep_str ++ args_hex_hash; |
| 1830 | | try b.cache_root.handle.writeFile(.{ .sub_path = args_file, .data = args }); |
| 1830 | if (b.cache_root.handle.access(args_file, .{})) |_| { |
| 1831 | // The args file is already present from a previous run. |
| 1832 | } else |err| switch (err) { |
| 1833 | error.FileNotFound => { |
| 1834 | try b.cache_root.handle.makePath("tmp"); |
| 1835 | const rand_int = std.crypto.random.int(u64); |
| 1836 | const tmp_path = "tmp" ++ fs.path.sep_str ++ std.fmt.hex(rand_int); |
| 1837 | try b.cache_root.handle.writeFile(.{ .sub_path = tmp_path, .data = args }); |
| 1838 | defer b.cache_root.handle.deleteFile(tmp_path) catch { |
| 1839 | // It's fine if the temporary file can't be cleaned up. |
| 1840 | }; |
| 1841 | b.cache_root.handle.rename(tmp_path, args_file) catch |rename_err| switch (rename_err) { |
| 1842 | error.PathAlreadyExists => { |
| 1843 | // The args file was created by another concurrent build process. |
| 1844 | }, |
| 1845 | else => |other_err| return other_err, |
| 1846 | }; |
| 1847 | }, |
| 1848 | else => |other_err| return other_err, |
| 1849 | } |
| 1831 | 1850 | |
| 1832 | 1851 | const resolved_args_file = try mem.concat(arena, u8, &.{ |
| 1833 | 1852 | "@", |