| 62 | } |
| 63 | |
| 64 | bool TestRedisServer::WaitProcess(int pipefd[2]) { |
| 65 | close(pipefd[1]); |
| 66 | FILE *output = fdopen(pipefd[0], "r"); |
| 67 | |
| 68 | unsigned int i = 0; |
| 69 | do { |
| 70 | i++; |
| 71 | char *buffer = NULL; |
| 72 | size_t n; |
| 73 | getline(&buffer, &n, output); |
| 74 | if (n <= 0) { |
| 75 | free(buffer); |
| 76 | continue; |
| 77 | } |
| 78 | string line(buffer); |
| 79 | free(buffer); |
| 80 | |
| 81 | size_t found = line.find(key); |
| 82 | if (found != string::npos) { |
| 83 | return true; |
| 84 | } |
| 85 | |
| 86 | } while (i < maxlines); |
| 87 | |
| 88 | return false; |
| 89 | } |
| 90 | |
| 91 | void TestRedisServer::StartProcess(int pipefd[2]) { |
| 92 | // Close the unused read end |