MCPcopy Create free account
hub / github.com/GJDuck/e9patch / waitBackend

Function waitBackend

src/e9tool/e9tool.cpp:141–161  ·  view source on GitHub ↗

* Wait for e9patch instance to terminate. */

Source from the content-addressed store, hash-verified

139 * Wait for e9patch instance to terminate.
140 */
141static void waitBackend(const Backend &backend)
142{
143 fclose(backend.out);
144
145 if (backend.pid == 0)
146 return;
147 int status;
148 do
149 {
150 if (waitpid(backend.pid, &status, WUNTRACED | WCONTINUED) < 0)
151 error("failed to wait for backend process (%d): %s",
152 backend.pid, strerror(errno));
153 }
154 while (!WIFEXITED(status) && !WIFSIGNALED(status));
155 if (WIFEXITED(status) && WEXITSTATUS(status) != 0)
156 error("backend process (%d) exitted with a non-zero status (%d)",
157 backend.pid, WEXITSTATUS(status));
158 else if (WIFSIGNALED(status))
159 error("backend process (%d) killed by signal (%s)", backend.pid,
160 strsignal(WTERMSIG(status)));
161}
162
163/*
164 * Open a new plugin object.

Callers 1

main_2Function · 0.85

Calls 5

fcloseFunction · 0.85
waitpidFunction · 0.85
errorFunction · 0.85
strerrorFunction · 0.85
strsignalFunction · 0.85

Tested by

no test coverage detected