diff options
| author | iryuken <eshwarsajja20@gmail.com> | 2026-01-25 23:57:07 +0530 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-01-25 23:57:07 +0530 |
| commit | a2804ffe502ec31fc3bf561b7e59c25622b15e19 (patch) | |
| tree | 3fb732563d6a282e010bca2d3acb97eb351c925f /src/parser/parser_stmt.c | |
| parent | 123a961710aab45f30367cb8faa2c8ce00e49bdb (diff) | |
| parent | e3ab29bb4d7174cae65de2275f19105eb3d93d91 (diff) | |
Merge branch 'z-libs:main' into main
Diffstat (limited to 'src/parser/parser_stmt.c')
| -rw-r--r-- | src/parser/parser_stmt.c | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/src/parser/parser_stmt.c b/src/parser/parser_stmt.c index 0c3885a..aba6f5e 100644 --- a/src/parser/parser_stmt.c +++ b/src/parser/parser_stmt.c @@ -3179,8 +3179,16 @@ char *run_comptime_block(ParserContext *ctx, Lexer *l) char cmd[4096]; char bin[1024]; +#ifdef _WIN32 + sprintf(bin, "%s.exe", filename); +#else sprintf(bin, "%s.bin", filename); - sprintf(cmd, "gcc %s -o %s > /dev/null 2>&1", filename, bin); +#endif + sprintf(cmd, "%s %s -o %s", g_config.cc, filename, bin); + if (!g_config.verbose) + { + strcat(cmd, " > /dev/null 2>&1"); + } int res = system(cmd); if (res != 0) { @@ -3189,7 +3197,14 @@ char *run_comptime_block(ParserContext *ctx, Lexer *l) char out_file[1024]; sprintf(out_file, "%s.out", filename); + + // Platform-neutral execution +#ifdef _WIN32 + sprintf(cmd, "%s > %s", bin, out_file); +#else sprintf(cmd, "./%s > %s", bin, out_file); +#endif + if (system(cmd) != 0) { zpanic_at(lexer_peek(l), "Comptime execution failed"); |
