aboutsummaryrefslogtreecommitdiff
path: root/src/Compilation.zig
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2025-12-08 16:13:51 -0800
committerAndrew Kelley <andrew@ziglang.org>2025-12-23 22:15:08 -0800
commit9ccd68de0b79c3723bd11071fd836bc24ff25b33 (patch)
tree3441f2a7030f40a6b625f4ff9fc7d719a60a32d3 /src/Compilation.zig
parent7f5bb118d4d90e2b883ee66e17592ac8d7808ac8 (diff)
downloadzig-9ccd68de0b79c3723bd11071fd836bc24ff25b33.tar.gz
zig-9ccd68de0b79c3723bd11071fd836bc24ff25b33.zip
std: move abort and exit from posix into process
and delete the unit tests that called fork() no forking allowed in the std lib, including unit tests, except to implement child process spawning.
Diffstat (limited to 'src/Compilation.zig')
-rw-r--r--src/Compilation.zig10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/Compilation.zig b/src/Compilation.zig
index 3a48705880..280d34cdbf 100644
--- a/src/Compilation.zig
+++ b/src/Compilation.zig
@@ -3180,7 +3180,7 @@ pub fn update(comp: *Compilation, main_progress_node: std.Progress.Node) UpdateE
const s = fs.path.sep_str;
const tmp_dir_sub_path = "tmp" ++ s ++ std.fmt.hex(tmp_dir_rand_int);
const o_sub_path = "o" ++ s ++ hex_digest;
- renameTmpIntoCache(comp.dirs.local_cache, tmp_dir_sub_path, o_sub_path) catch |err| {
+ renameTmpIntoCache(io, comp.dirs.local_cache, tmp_dir_sub_path, o_sub_path) catch |err| {
return comp.setMiscFailure(
.rename_results,
"failed to rename compilation results ('{f}{s}') into local cache ('{f}{s}'): {t}",
@@ -3399,17 +3399,19 @@ fn flush(
/// implementation at the bottom of this function.
/// This function is only called when CacheMode is `whole`.
fn renameTmpIntoCache(
+ io: Io,
cache_directory: Cache.Directory,
tmp_dir_sub_path: []const u8,
o_sub_path: []const u8,
) !void {
var seen_eaccess = false;
while (true) {
- fs.rename(
+ Io.Dir.rename(
cache_directory.handle,
tmp_dir_sub_path,
cache_directory.handle,
o_sub_path,
+ io,
) catch |err| switch (err) {
// On Windows, rename fails with `AccessDenied` rather than `PathAlreadyExists`.
// See https://github.com/ziglang/zig/issues/8362
@@ -3427,7 +3429,7 @@ fn renameTmpIntoCache(
continue;
},
error.FileNotFound => {
- try cache_directory.handle.makePath("o");
+ try cache_directory.handle.makePath(io, "o");
continue;
},
else => |e| return e,
@@ -5816,7 +5818,7 @@ pub fn translateC(
const o_sub_path = "o" ++ fs.path.sep_str ++ hex_digest;
if (comp.verbose_cimport) log.info("renaming {s} to {s}", .{ tmp_sub_path, o_sub_path });
- try renameTmpIntoCache(comp.dirs.local_cache, tmp_sub_path, o_sub_path);
+ try renameTmpIntoCache(io, comp.dirs.local_cache, tmp_sub_path, o_sub_path);
return .{
.digest = bin_digest,