Zig Version
0.12.0-dev.3161+377ecc6af
Steps to Reproduce and Observed Behavior
// repro.zig
const std = @import("std");
pub fn main() !void {
var arena_state = std.heap.ArenaAllocator.init(std.heap.page_allocator);
defer arena_state.deinit();
const arena = arena_state.allocator();
const args = try std.process.argsAlloc(arena);
for (args, 0..) |arg, i| std.debug.print("args[{}]: \"{s}\"\n", .{ i, arg });
}
zig run .\repro.zig -- hello "" world
args[0]: "C:\...\repro.exe"
args[1]: "hello"
args[2]: "world"
Running the executable directly works.
C:\...\repro.exe hello "" world
args[0]: "C:\...\repro.exe"
args[1]: "hello"
args[2]: ""
args[3]: "world"
Invoking the executable directly from Zig using std.process.Child.init(&.{ repro_path, "hello", "", "world" }, arena) also works, so it doesn't appear to be a bug in the argv-to-command line serialization logic.
Appears to be a Windows-only bug, people on Discord helped me verify that it works correctly on Linux and macOS.
zig build run (where run is a Step.Run) is also affected.
Expected Behavior
The empty string is passed to the spawned process.
Zig Version
0.12.0-dev.3161+377ecc6af
Steps to Reproduce and Observed Behavior
Running the executable directly works.
Invoking the executable directly from Zig using
std.process.Child.init(&.{ repro_path, "hello", "", "world" }, arena)also works, so it doesn't appear to be a bug in the argv-to-command line serialization logic.Appears to be a Windows-only bug, people on Discord helped me verify that it works correctly on Linux and macOS.
zig build run(whererunis aStep.Run) is also affected.Expected Behavior
The empty string is passed to the spawned process.