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`.
This commit is contained in:
Timon Kruiper
2020-11-09 21:17:57 +01:00
committed by Andrew Kelley
parent d9c808e3ff
commit 97692cb4fe

View File

@@ -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();