authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2019-02-23 20:25:33-05:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2019-02-23 20:25:33-05:00
log98869edb8b44f164bb46851cff88e2338fe6f399
tree9716ca0b24695e7b8312cb9e857d742ca54d9916
parent00d8f4a1bb634ec5b0569e6ff6c2679ade2bd6b0
signaturelock-open Commit is signed but in an unrecognized format.

fix `zig fmt` arg0 handled incorrectly


2 files changed, 11 insertions(+), 9 deletions(-)

src/main.cpp+10-8
......@@ -549,18 +549,20 @@ int main(int argc, char **argv) {
549549
550550 codegen_build_and_link(g);
551551
552 ZigList<const char*> args = {0};
552 // TODO standardize os.cpp so that the args are supposed to have the exe
553 ZigList<const char*> args_with_exe = {0};
554 ZigList<const char*> args_without_exe = {0};
555 const char *exec_path = buf_ptr(&g->output_file_path);
556 args_with_exe.append(exec_path);
553557 for (int i = 2; i < argc; i += 1) {
554 args.append(argv[i]);
558 args_with_exe.append(argv[i]);
559 args_without_exe.append(argv[i]);
555560 }
556 args.append(nullptr);
557 const char *exec_path = buf_ptr(&g->output_file_path);
558
559 os_execv(exec_path, args.items);
561 args_with_exe.append(nullptr);
562 os_execv(exec_path, args_with_exe.items);
560563
561 args.pop();
562564 Termination term;
563 os_spawn_process(exec_path, args, &term);
565 os_spawn_process(exec_path, args_without_exe, &term);
564566 return term.code;
565567 }
566568
std/special/fmt_runner.zig+1-1
......@@ -37,7 +37,7 @@ pub fn main() !void {
3737 stderr = &stderr_out_stream.stream;
3838 const args = try std.os.argsAlloc(allocator);
3939
40 var flags = try Args.parse(allocator, self_hosted_main.args_fmt_spec, args);
40 var flags = try Args.parse(allocator, self_hosted_main.args_fmt_spec, args[1..]);
4141 defer flags.deinit();
4242
4343 if (flags.present("help")) {