259
259
//start child process
260
BOOL ok=create_child_process(lStdOut,lStdErr,aCommand,lChildProcessInfo);
260
BOOL ok = create_child_process(lStdOut,lStdErr,aCommand,lChildProcessInfo);
413
413
std::ostringstream lStderr;
416
std::string lCommandLineString=lTmp.str();
417
int code = run_process(lCommandLineString,lStdout,lStderr);
416
std::string lCommandLineString = lTmp.str();
417
int code = run_process(lCommandLineString, lStdout, lStderr);
473
waitpid(pid, &stat, 0);
477
w = waitpid(pid, &stat, WUNTRACED | WCONTINUED);
474
pid_t w = waitpid(pid, &stat, 0);
478
std::stringstream lErrorMsg;
479
lErrorMsg << "Failed to wait for child process ";
480
Item lQName = ProcessModule::getItemFactory()->createQName(
481
"http://www.zorba-xquery.com/modules/process", "PROC01");
482
throw USER_EXCEPTION(lQName, lErrorMsg.str().c_str());
486
printf("exited, status=%d\n", WEXITSTATUS(stat));
488
else if (WIFSIGNALED(stat))
490
printf("killed by signal %d\n", WTERMSIG(stat));
492
else if (WIFSTOPPED(stat))
494
printf("stopped by signal %d\n", WSTOPSIG(stat));
496
else if (WIFCONTINUED(stat))
498
printf("continued\n");
500
} while (!WIFEXITED(stat) && !WIFSIGNALED(stat));
502
exit_code = WEXITSTATUS(stat);
487
//std::cout << " WEXITSTATUS : " << WEXITSTATUS(stat) << std::endl; std::cout.flush();
488
exit_code = WEXITSTATUS(stat);
490
else if (WIFSIGNALED(stat))
492
//std::cout << " WTERMSIG : " << WTERMSIG(stat) << std::endl; std::cout.flush();
493
exit_code = 128 + WTERMSIG(stat);
495
else if (WIFSTOPPED(stat))
497
//std::cout << " STOPSIG : " << WSTOPSIG(stat) << std::endl; std::cout.flush();
498
exit_code = 128 + WSTOPSIG(stat);
502
//std::cout << " else : " << std::endl; std::cout.flush();
506
//std::cout << " exit_code : " << exit_code << std::endl; std::cout.flush();