mirror of
https://github.com/ziglang/zig.git
synced 2026-02-13 04:48:20 +00:00
stage2: Fix arg processing for zig run
* Stop parsing arguments after `--` * Calculate the correct index for the first argument after `--`
This commit is contained in:
parent
58502b8bfe
commit
87807d53dd
@ -525,7 +525,7 @@ fn buildOutputType(
|
||||
//}
|
||||
const args = all_args[2..];
|
||||
var i: usize = 0;
|
||||
while (i < args.len) : (i += 1) {
|
||||
args_loop: while (i < args.len) : (i += 1) {
|
||||
const arg = args[i];
|
||||
if (mem.startsWith(u8, arg, "-")) {
|
||||
if (mem.eql(u8, arg, "-h") or mem.eql(u8, arg, "--help")) {
|
||||
@ -533,7 +533,10 @@ fn buildOutputType(
|
||||
return cleanExit();
|
||||
} else if (mem.eql(u8, arg, "--")) {
|
||||
if (arg_mode == .run) {
|
||||
runtime_args_start = i + 1;
|
||||
// The index refers to all_args so skip `zig` `run`
|
||||
// and `--`
|
||||
runtime_args_start = i + 3;
|
||||
break :args_loop;
|
||||
} else {
|
||||
fatal("unexpected end-of-parameter mark: --", .{});
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user