| 114 | |
| 115 | namespace Exec { |
| 116 | int32_t ExecAndWaitForResponse(const char* path, char* const* args) { |
| 117 | pid_t pid = fork(); |
| 118 | if (pid == 0) { |
| 119 | execvp(path, args); |
| 120 | _exit(-1); |
| 121 | } else { |
| 122 | int32_t Status {}; |
| 123 | waitpid(pid, &Status, 0); |
| 124 | if (WIFEXITED(Status)) { |
| 125 | return (int8_t)WEXITSTATUS(Status); |
| 126 | } |
| 127 | } |
| 128 | |
| 129 | return -1; |
| 130 | } |
| 131 | |
| 132 | int32_t ExecAndWaitForResponseRedirect(const char* path, char* const* args, int stdoutRedirect = -2, int stderrRedirect = -2) { |
| 133 | pid_t pid = fork(); |
no outgoing calls
no test coverage detected