diff options
| author | Stephen Gutekanst <stephen@hexops.com> | 2022-03-05 15:23:08 -0700 |
|---|---|---|
| committer | Stephen Gutekanst <stephen@hexops.com> | 2022-03-05 16:27:29 -0700 |
| commit | c3a2b51a2cdd5a64401df2ad326c20f151455f00 (patch) | |
| tree | 35e62307e7e000c8a18a2d42ab90c58e84b3c3c0 /src | |
| parent | cfb4f48941b194151fa1b6a4958b161dba139996 (diff) | |
| download | zig-c3a2b51a2cdd5a64401df2ad326c20f151455f00.tar.gz zig-c3a2b51a2cdd5a64401df2ad326c20f151455f00.zip | |
fix regression in `zig run` runtime arguments
This brings back #10950, which was reverted in 5ab5e2e6731a9f1198df6c53134545ccc6a6bbd3
because it [introduced a regression in `zig run`](https://github.com/ziglang/zig/pull/10950#issuecomment-1049481212)
where the runtime arguments passed were incorrect.
I've fixed the issue, and notably this was the only location where we
directly relied on accessing arguments by index in this code still (all
other locations use the iterator proper) and so we should be all good to
go now.
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
Diffstat (limited to 'src')
| -rw-r--r-- | src/main.zig | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/main.zig b/src/main.zig index 958849f0a5..3f4d124f00 100644 --- a/src/main.zig +++ b/src/main.zig @@ -799,9 +799,9 @@ fn buildOutputType( return cleanExit(); } else if (mem.eql(u8, arg, "--")) { if (arg_mode == .run) { - // The index refers to all_args so skip `zig` `run` - // and `--` - runtime_args_start = args_iter.i + 3; + // args_iter.i is 1, referring the next arg after "--" in ["--", ...] + // Add +2 to the index so it is relative to all_args + runtime_args_start = args_iter.i + 2; break :args_loop; } else { fatal("unexpected end-of-parameter mark: --", .{}); |
