diff --git a/build.zig b/build.zig index 0e40678..33b117d 100644 --- a/build.zig +++ b/build.zig @@ -51,7 +51,7 @@ pub fn build(b: *zbs.Builder) void { cmph.addIncludeDir("include/deps/cmph"); { - const exe = b.addExecutable("turbo-unix2db", "cli/unix2db/main.zig"); + const exe = b.addExecutable("turbo-unix2db", "src/unix2db/main.zig"); exe.setTarget(target); exe.setBuildMode(mode); addCmphDeps(exe, cmph); diff --git a/src/unix2db/main.zig b/src/unix2db/main.zig index cff7ebf..5eed32f 100644 --- a/src/unix2db/main.zig +++ b/src/unix2db/main.zig @@ -26,12 +26,14 @@ const usage = pub fn main() !void { // This line is here because of https://github.com/ziglang/zig/issues/7807 const argv: []const [*:0]const u8 = os.argv; - const gpa = GeneralPurposeAllocator(.{}); + var gpa = GeneralPurposeAllocator(.{}){}; + defer gpa.deinit(); + const allocator = gpa.allocator(); - const stderr = try io.getStdErr(); - const stdout = try io.getStdOut(); + const stderr = io.getStdErr().writer(); + const stdout = io.getStdOut().writer(); - const return_code = execute(gpa, stdout, stderr, argv[1..]); + const return_code = execute(allocator, stdout, stderr, argv[1..]); os.exit(return_code); }