Do not handle system-specific values in command.c

The common command.c handled process errors from system-specific int
values (errno).

Rather, expose a new enum process_result to handle error cause in a
generic way.
This commit is contained in:
Romain Vimont
2018-09-04 08:42:25 +02:00
parent 6d2d803003
commit 55d33ddd5f
4 changed files with 35 additions and 30 deletions

View File

@@ -32,7 +32,13 @@
#endif
# define NO_EXIT_CODE -1
int cmd_execute(const char *path, const char *const argv[], process_t *process);
enum process_result {
PROCESS_SUCCESS,
PROCESS_ERROR_GENERIC,
PROCESS_ERROR_MISSING_BINARY,
};
enum process_result cmd_execute(const char *path, const char *const argv[], process_t *process);
SDL_bool cmd_terminate(process_t pid);
SDL_bool cmd_simple_wait(process_t pid, exit_code_t *exit_code);