mirror of
https://github.com/odin-lang/Odin.git
synced 2026-06-05 02:04:06 +00:00
improve orca target
This commit is contained in:
28
src/main.cpp
28
src/main.cpp
@@ -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();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user