| 150 | } |
| 151 | |
| 152 | int waitProcess(Process *process) { |
| 153 | #if defined(WIN32) || defined(_WIN32) || defined(WIN64) || defined(_WIN64) |
| 154 | DWORD exitCode; |
| 155 | WaitForSingleObject(process->hProcess, INFINITE); |
| 156 | GetExitCodeProcess(process->hProcess, &exitCode); |
| 157 | CloseHandle(process->hProcess); |
| 158 | CloseHandle(process->hThread); |
| 159 | return (int)exitCode; |
| 160 | #else |
| 161 | int status = 0; |
| 162 | do { |
| 163 | if (0 > waitpid(*process, &status, 0)) { |
| 164 | return errno; |
| 165 | } |
| 166 | } while (!WIFEXITED(status)); |
| 167 | return WEXITSTATUS(status); |
| 168 | #endif |
| 169 | } |
| 170 | |
| 171 | #if defined(__linux__) || defined(__QNX__) |
| 172 | int ipcCreateSocket(ipcHandle *&handle, const char *name, |