authorgravatar for stephen@hexops.comStephen Gutekanst <stephen@hexops.com> 2022-03-05 15:23:08-07:00
committergravatar for stephen@hexops.comStephen Gutekanst <stephen@hexops.com> 2022-03-05 16:27:29-07:00
logc3a2b51a2cdd5a64401df2ad326c20f151455f00
tree35e62307e7e000c8a18a2d42ab90c58e84b3c3c0
parentcfb4f48941b194151fa1b6a4958b161dba139996

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>

1 files changed, 3 insertions(+), 3 deletions(-)

src/main.zig+3-3
...@@ -799,9 +799,9 @@ fn buildOutputType(...@@ -799,9 +799,9 @@ fn buildOutputType(
799 return cleanExit();799 return cleanExit();
800 } else if (mem.eql(u8, arg, "--")) {800 } else if (mem.eql(u8, arg, "--")) {
801 if (arg_mode == .run) {801 if (arg_mode == .run) {
802 // The index refers to all_args so skip `zig` `run`802 // args_iter.i is 1, referring the next arg after "--" in ["--", ...]
803 // and `--`803 // Add +2 to the index so it is relative to all_args
804 runtime_args_start = args_iter.i + 3;804 runtime_args_start = args_iter.i + 2;
805 break :args_loop;805 break :args_loop;
806 } else {806 } else {
807 fatal("unexpected end-of-parameter mark: --", .{});807 fatal("unexpected end-of-parameter mark: --", .{});