From 97692cb4fefcfe54564fdea0e70b656aec5e6f77 Mon Sep 17 00:00:00 2001 From: Timon Kruiper Date: Mon, 9 Nov 2020 21:17:57 +0100 Subject: [PATCH] Do not keep the build.zig cache manifest file locked. This allows to have multiple instances of `zig build` at the same time. For example when you have a long running `zig build run` and then want to run `zig build somethingelse`. --- src/main.zig | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/src/main.zig b/src/main.zig index b4f8dfbf88..d590867e2d 100644 --- a/src/main.zig +++ b/src/main.zig @@ -2208,7 +2208,7 @@ pub const usage_build = pub fn cmdBuild(gpa: *Allocator, arena: *Allocator, args: []const []const u8) !void { // We want to release all the locks before executing the child process, so we make a nice // big block here to ensure the cleanup gets run when we extract out our argv. - const lock_and_argv = lock_and_argv: { + const child_argv = argv: { const self_exe_path = try fs.selfExePathAlloc(arena); var build_file: ?[]const u8 = null; @@ -2403,15 +2403,8 @@ pub fn cmdBuild(gpa: *Allocator, arena: *Allocator, args: []const []const u8) !v &[_][]const u8{exe_basename}, ); - break :lock_and_argv .{ - .child_argv = child_argv.items, - .lock = comp.bin_file.toOwnedLock(), - }; + break :argv child_argv.items; }; - const child_argv = lock_and_argv.child_argv; - var lock = lock_and_argv.lock; - defer lock.release(); - const child = try std.ChildProcess.init(child_argv, gpa); defer child.deinit();