< prev index next >

modules/jdk.packager/src/main/native/library/common/PosixPlatform.cpp

Print this page




 292             if (AWait == true) {
 293                 ReadOutput();
 294                 Wait();
 295                 Cleanup();
 296                 FRunning = false;
 297                 result = true;
 298             }
 299             else {
 300                 result = true;
 301             }
 302         }
 303     }
 304 
 305     return result;
 306 }
 307 
 308 bool PosixProcess::Wait() {
 309     bool result = false;
 310 
 311     int status = 0;
 312     pid_t wpid;
 313 
 314     //TODO Use waitpid instead of wait
 315 #ifdef LINUX
 316     wait();
 317 #endif
 318 #ifdef MAC
 319     wpid = wait(&status);
 320 #endif
 321 
 322     if (!WIFEXITED(status) || WEXITSTATUS(status) != 0) {
 323         if (errno != EINTR){
 324             status = -1;
 325         }
 326     }
 327 
 328 #ifdef DEBUG
 329     if (WIFEXITED(status)) {
 330         printf("child exited, status=%d\n", WEXITSTATUS(status));
 331     } else if (WIFSIGNALED(status)) {
 332         printf("child killed (signal %d)\n", WTERMSIG(status));




 292             if (AWait == true) {
 293                 ReadOutput();
 294                 Wait();
 295                 Cleanup();
 296                 FRunning = false;
 297                 result = true;
 298             }
 299             else {
 300                 result = true;
 301             }
 302         }
 303     }
 304 
 305     return result;
 306 }
 307 
 308 bool PosixProcess::Wait() {
 309     bool result = false;
 310 
 311     int status = 0;
 312     pid_t wpid = -1;
 313 
 314     //TODO Use waitpid instead of wait
 315 #ifdef LINUX
 316     wait();
 317 #endif
 318 #ifdef MAC
 319     wpid = wait(&status);
 320 #endif
 321 
 322     if (!WIFEXITED(status) || WEXITSTATUS(status) != 0) {
 323         if (errno != EINTR){
 324             status = -1;
 325         }
 326     }
 327 
 328 #ifdef DEBUG
 329     if (WIFEXITED(status)) {
 330         printf("child exited, status=%d\n", WEXITSTATUS(status));
 331     } else if (WIFSIGNALED(status)) {
 332         printf("child killed (signal %d)\n", WTERMSIG(status));


< prev index next >