Closed michidk closed 3 months ago
The following code:
var gpa = std.heap.GeneralPurposeAllocator(.{}){}; defer std.debug.assert(gpa.deinit() == .ok); var alloc = gpa.allocator(); const params = comptime clap.parseParamsComptime( \\-h Display this help. \\<str> The host to connect to. \\ ); var diag = clap.Diagnostic{}; var res = clap.parse(clap.Help, ¶ms, clap.parsers.default, .{ .diagnostic = &diag, .allocator = alloc, }) catch |err| { diag.report(io.getStdErr().writer(), err) catch {}; return err; }; defer res.deinit();
Errors out while building:
vscode ➜ /workspaces/my-project (main) $ zig build run -- -h zig build-exe my-project Debug native: error: the following command terminated unexpectedly: /usr/local/lib/zig/zig build-exe /workspaces/my-project/src/main.zig --cache-dir /workspaces/my-project/zig-cache --global-cache-dir /home/vscode/.cache/zig --name my-project --mod clap::/home/vscode/.cache/zig/p/1220f48518ce22882e102255ed3bcdb7aeeb4891f50b2cdd3bd74b5b2e24d3149ba2/clap.zig --deps clap --listen=- Build Summary: 0/5 steps succeeded; 1 failed (disable with --summary none) run transitive failure └─ run my-project transitive failure ├─ zig build-exe my-project Debug native failure └─ install transitive failure └─ install my-project transitive failure └─ zig build-exe my-project Debug native (reused) error: the following build command failed with exit code 1: /workspaces/my-project/zig-cache/o/0eb5808b79de382229c649195106f6bc/build /usr/local/lib/zig/zig /workspaces/my-project /workspaces/my-project/zig-cache /home/vscode/.cache/zig run -- -h
It works fine once I change the params to:
const params = comptime clap.parseParamsComptime( \\-h,--help Display this help. \\<str> The host to connect to. \\ );
Hmm. I don't see a compiler error. I suspect a compiler crash. Is this the same as https://github.com/Hejsil/zig-clap/issues/84 ?
Seems to be fixed with the latest version of zig
The following code:
Errors out while building:
It works fine once I change the params to: