improve orca target

This commit is contained in:
Laytan Laats
2024-06-05 20:57:39 +02:00
parent c406bbb6e3
commit 8455e159f5
13 changed files with 200 additions and 31 deletions

View File

@@ -155,6 +155,34 @@ gb_internal i32 system_exec_command_line_app(char const *name, char const *fmt,
return exit_code;
}
// TODO: windows.
gb_internal bool system_exec_command_line_app_output(char const *command, gbString *output) {
GB_ASSERT(output);
u8 buffer[256];
FILE *stream;
stream = popen(command, "r");
if (!stream) {
return false;
}
defer (pclose(stream));
while (!feof(stream)) {
size_t n = fread(buffer, 1, 255, stream);
*output = gb_string_append_length(*output, buffer, n);
if (ferror(stream)) {
return false;
}
}
if (build_context.show_system_calls) {
gb_printf_err("[SYSTEM CALL OUTPUT] %s -> %s\n", command, *output);
}
return true;
}
gb_internal Array<String> setup_args(int argc, char const **argv) {
gbAllocator a = heap_allocator();