Changeset 2224
- Timestamp:
- 07/08/2008 17:31:32 (5 months ago)
- Location:
- box/trunk/lib/server
- Files:
-
- 2 modified
-
ServerControl.cpp (modified) (3 diffs)
-
ServerControl.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
box/trunk/lib/server/ServerControl.cpp
r2171 r2224 5 5 #ifdef HAVE_SYS_TYPES_H 6 6 #include <sys/types.h> 7 #endif 8 9 #ifdef HAVE_SYS_WAIT_H 10 #include <sys/wait.h> 7 11 #endif 8 12 … … 161 165 #endif // WIN32 162 166 163 bool KillServer(int pid )167 bool KillServer(int pid, bool WaitForProcess) 164 168 { 165 169 if (!KillServerInternal(pid)) … … 168 172 } 169 173 174 #ifdef HAVE_WAITPID 175 if (WaitForProcess) 176 { 177 int status, result; 178 179 result = waitpid(pid, &status, 0); 180 if (result != pid) 181 { 182 BOX_WARNING("waitpid returned " << result); 183 } 184 TEST_THAT(result == pid); 185 186 TEST_THAT(WIFEXITED(status)); 187 if (WIFEXITED(status)) 188 { 189 if (WEXITSTATUS(status) != 0) 190 { 191 BOX_WARNING("process exited with code " << 192 WEXITSTATUS(status)); 193 } 194 TEST_THAT(WEXITSTATUS(status) == 0); 195 } 196 } 197 #endif 198 170 199 for (int i = 0; i < 30; i++) 171 200 { 172 201 if (i == 0) 173 202 { 174 printf("Waiting for server to die : ");203 printf("Waiting for server to die (pid %d): ", pid); 175 204 } 176 205 -
box/trunk/lib/server/ServerControl.h
r2171 r2224 5 5 6 6 bool HUPServer(int pid); 7 bool KillServer(int pid );7 bool KillServer(int pid, bool WaitForProcess = false); 8 8 9 9 #ifdef WIN32
