MCPcopy Create free account
hub / github.com/ElementsProject/elements / checkSpawned

Method checkSpawned

src/ipc/process.cpp:38–56  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

36 }
37 int waitSpawned(int pid) override { return mp::WaitProcess(pid); }
38 bool checkSpawned(int argc, char* argv[], int& fd) override
39 {
40 // If this process was not started with a single -ipcfd argument, it is
41 // not a process spawned by the spawn() call above, so return false and
42 // do not try to serve requests.
43 if (argc != 3 || strcmp(argv[1], "-ipcfd") != 0) {
44 return false;
45 }
46 // If a single -ipcfd argument was provided, return true and get the
47 // file descriptor so Protocol::serve() can be called to handle
48 // requests from the parent process. The -ipcfd argument is not valid
49 // in combination with other arguments because the parent process
50 // should be able to control the child process through the IPC protocol
51 // without passing information out of band.
52 if (!ParseInt32(argv[2], &fd)) {
53 throw std::runtime_error(strprintf("Invalid -ipcfd number '%s'", argv[2]));
54 }
55 return true;
56 }
57};
58} // namespace
59

Callers 1

startSpawnedProcessMethod · 0.80

Calls 1

ParseInt32Function · 0.50

Tested by

no test coverage detected