| ... | @@ -549,18 +549,20 @@ int main(int argc, char **argv) { | ... | @@ -549,18 +549,20 @@ int main(int argc, char **argv) { |
| 549 | | 549 | |
| 550 | codegen_build_and_link(g); | 550 | codegen_build_and_link(g); |
| 551 | | 551 | |
| 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); |
| 553 | for (int i = 2; i < argc; i += 1) { | 557 | 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]); |
| 555 | } | 560 | } |
| 556 | args.append(nullptr); | 561 | args_with_exe.append(nullptr); |
| 557 | const char *exec_path = buf_ptr(&g->output_file_path); | 562 | os_execv(exec_path, args_with_exe.items); |
| 558 | | | |
| 559 | os_execv(exec_path, args.items); | | |
| 560 | | 563 | |
| 561 | args.pop(); | | |
| 562 | Termination term; | 564 | Termination term; |
| 563 | os_spawn_process(exec_path, args, &term); | 565 | os_spawn_process(exec_path, args_without_exe, &term); |
| 564 | return term.code; | 566 | return term.code; |
| 565 | } | 567 | } |
| 566 | | 568 | |