authorgravatar for timonkruiper@gmail.comTimon Kruiper <timonkruiper@gmail.com> 2020-11-09 21:17:57+01:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2020-12-09 22:16:04-05:00
log4c51adeb0d1dac916dfc117244e14804d3adec8d
tree39a32cceff9011cc78556aef82cbdc295e77ac1e
parent7c93d9aacb5987c3ada52f7f68c6f38594e08612

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`.

1 files changed, 2 insertions(+), 9 deletions(-)

src/main.zig+2-9
......@@ -2240,7 +2240,7 @@ pub const usage_build =
22402240pub fn cmdBuild(gpa: *Allocator, arena: *Allocator, args: []const []const u8) !void {
22412241 // We want to release all the locks before executing the child process, so we make a nice
22422242 // big block here to ensure the cleanup gets run when we extract out our argv.
2243 const lock_and_argv = lock_and_argv: {
2243 const child_argv = argv: {
22442244 const self_exe_path = try fs.selfExePathAlloc(arena);
22452245
22462246 var build_file: ?[]const u8 = null;
......@@ -2436,15 +2436,8 @@ pub fn cmdBuild(gpa: *Allocator, arena: *Allocator, args: []const []const u8) !v
24362436 &[_][]const u8{exe_basename},
24372437 );
24382438
2439 break :lock_and_argv .{
2440 .child_argv = child_argv.items,
2441 .lock = comp.bin_file.toOwnedLock(),
2442 };
2439 break :argv child_argv.items;
24432440 };
2444 const child_argv = lock_and_argv.child_argv;
2445 var lock = lock_and_argv.lock;
2446 defer lock.release();
2447
24482441 const child = try std.ChildProcess.init(child_argv, gpa);
24492442 defer child.deinit();
24502443