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 =...@@ -2240,7 +2240,7 @@ pub const usage_build =
2240pub fn cmdBuild(gpa: *Allocator, arena: *Allocator, args: []const []const u8) !void {2240pub fn cmdBuild(gpa: *Allocator, arena: *Allocator, args: []const []const u8) !void {
2241 // We want to release all the locks before executing the child process, so we make a nice2241 // We want to release all the locks before executing the child process, so we make a nice
2242 // big block here to ensure the cleanup gets run when we extract out our argv.2242 // 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: {
2244 const self_exe_path = try fs.selfExePathAlloc(arena);2244 const self_exe_path = try fs.selfExePathAlloc(arena);
22452245
2246 var build_file: ?[]const u8 = null;2246 var build_file: ?[]const u8 = null;
...@@ -2436,15 +2436,8 @@ pub fn cmdBuild(gpa: *Allocator, arena: *Allocator, args: []const []const u8) !v...@@ -2436,15 +2436,8 @@ pub fn cmdBuild(gpa: *Allocator, arena: *Allocator, args: []const []const u8) !v
2436 &[_][]const u8{exe_basename},2436 &[_][]const u8{exe_basename},
2437 );2437 );
24382438
2439 break :lock_and_argv .{2439 break :argv child_argv.items;
2440 .child_argv = child_argv.items,
2441 .lock = comp.bin_file.toOwnedLock(),
2442 };
2443 };2440 };
2444 const child_argv = lock_and_argv.child_argv;
2445 var lock = lock_and_argv.lock;
2446 defer lock.release();
2447
2448 const child = try std.ChildProcess.init(child_argv, gpa);2441 const child = try std.ChildProcess.init(child_argv, gpa);
2449 defer child.deinit();2442 defer child.deinit();
24502443