MCPcopy Create free account
hub / github.com/cinemast/libjson-rpc-cpp / StartProcess

Method StartProcess

src/test/testredisserver.cpp:91–110  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

89}
90
91void TestRedisServer::StartProcess(int pipefd[2]) {
92 // Close the unused read end
93 close(pipefd[0]);
94
95 // We don't want input going to this process or errors from it.
96 FILE *f_null = fopen("/dev/null", "r+");
97 if (f_null == NULL) {
98 cerr << "ERROR: Failed to open /dev/null for redis server!" << endl;
99 }
100 dup2(fileno(f_null), STDIN_FILENO);
101 dup2(fileno(f_null), STDERR_FILENO);
102 fclose(f_null);
103
104 // Redirect output to our filedescriptor
105 dup2(pipefd[1], STDOUT_FILENO);
106
107 // Start redis server with our redis.conf
108 execlp(REDIS_BIN, REDIS_BIN, REDIS_CONF, (char *)NULL);
109 exit(-1);
110}

Callers 1

StartMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected