From 875673c97e5a7ef9d94df7831cf4f452082e404e Mon Sep 17 00:00:00 2001 From: John Schmidt Date: Wed, 24 Jan 2024 23:36:14 +0100 Subject: [PATCH] work around Zig issue 12816 --- build.zig | 1 + src/test.zig | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/build.zig b/build.zig index 125aab7..6f5e5cd 100644 --- a/build.zig +++ b/build.zig @@ -60,6 +60,7 @@ pub fn build(b: *std.Build) !void { .link_libc = true, }); const run_tests = b.addRunArtifact(tests); + run_tests.step.dependOn(b.getInstallStep()); test_step.dependOn(&run_tests.step); } diff --git a/src/test.zig b/src/test.zig index 275cd4f..612b8e8 100644 --- a/src/test.zig +++ b/src/test.zig @@ -166,9 +166,13 @@ fn runCommand(db_path: []const u8, input: []const u8) !void { for (try splitArg(input)) |arg| { try argv.append(arg); } + var env = std.process.EnvMap.init(allocator); + try env.put("PATH", "/"); const result = try std.ChildProcess.exec(.{ .allocator = allocator, .argv = argv.items, + // Work around https://github.com/ziglang/zig/issues/12816 + .env_map = &env, }); if (print_output) { std.debug.print("{s} >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>\n", .{input});