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 20:16:26-07:00
log97692cb4fefcfe54564fdea0e70b656aec5e6f77
treec8d9c0e00082bea17f44b4eb04bd2f9baffb686e
parentd9c808e3ff5dc6f72d92457ac448b427d1ce66ff

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
......@@ -2208,7 +2208,7 @@ pub const usage_build =
22082208pub fn cmdBuild(gpa: *Allocator, arena: *Allocator, args: []const []const u8) !void {
22092209 // We want to release all the locks before executing the child process, so we make a nice
22102210 // big block here to ensure the cleanup gets run when we extract out our argv.
2211 const lock_and_argv = lock_and_argv: {
2211 const child_argv = argv: {
22122212 const self_exe_path = try fs.selfExePathAlloc(arena);
22132213
22142214 var build_file: ?[]const u8 = null;
......@@ -2403,15 +2403,8 @@ pub fn cmdBuild(gpa: *Allocator, arena: *Allocator, args: []const []const u8) !v
24032403 &[_][]const u8{exe_basename},
24042404 );
24052405
2406 break :lock_and_argv .{
2407 .child_argv = child_argv.items,
2408 .lock = comp.bin_file.toOwnedLock(),
2409 };
2406 break :argv child_argv.items;
24102407 };
2411 const child_argv = lock_and_argv.child_argv;
2412 var lock = lock_and_argv.lock;
2413 defer lock.release();
2414
24152408 const child = try std.ChildProcess.init(child_argv, gpa);
24162409 defer child.deinit();
24172410