- Timestamp:
- 2017-04-07T18:20:11+12:00 (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/trunk/greenstone3/src/java/org/greenstone/gsdl3/build/GS2PerlConstructor.java
r31591 r31592 335 335 // http://www.cgi101.com/class/ch3/text.html 336 336 // setenv QUERY_STRING and REQUEST_METHOD = GET. 337 // Run the perl command as a simple process: no logging to the collection's build log338 337 if (runPerlCommand(command_str, envvars, new File(cgi_directory))) 339 338 //new File(GlobalProperties.getGSDL3Home() + File.separator + "WEB-INF" + File.separator + "cgi"))) … … 402 401 } 403 402 404 // ModifyMetadata operations call runSimplePerlCommand which produces no output in build log 403 // If you want to run a Perl command without doing GS2PerlConstructor's custom logging in the build log 404 // The use the runSimplePerlCommand() versions, which use the default behaviour of running a SafeProcess 405 405 protected boolean runSimplePerlCommand(String[] command) { 406 406 return runSimplePerlCommand(command, null, null); … … 417 417 sendMessage(new ConstructionEvent(this, GSStatus.INFO, "command = " + command_str)); 418 418 419 logger.info("### Running simple command = " + command_str);419 ///logger.info("### Running simple command = " + command_str); 420 420 421 421 // This is where we create and run our perl process safely … … 459 459 sendMessage(new ConstructionEvent(this, GSStatus.INFO, "command = " + command_str)); 460 460 461 logger.info("### Running logged command = " + command_str);461 ///logger.info("### Running logged command = " + command_str); 462 462 463 463 // This is where we create and run our perl process safely … … 526 526 // Now display final message based on exit value 527 527 528 if (perlProcess.getExitValue() == 0) { 529 //status = OK;528 if (perlProcess.getExitValue() == 0) { //status = OK; 529 530 530 sendProcessStatus(new ConstructionEvent(this, GSStatus.CONTINUING, "Success")); 531 532 531 success = true; 533 } else { 534 532 533 } else { //status = ERROR; 535 534 sendProcessStatus(new ConstructionEvent(this, GSStatus.ERROR, "Failure")); 536 537 //return false;538 535 success = false; 539 536 540 537 } 541 } else { // cancelled 538 } else { // cancelled. The code would never come here, including in the old version of runPerlCommand 539 // but leaving this here for an exact port of the old runPerlCommand to the new one which 540 // uses SafeProcess. Also to allow the cancel functionality in future 542 541 543 542 // I need to somehow kill the child process. Unfortunately Thread.stop() and Process.destroy() both fail to do this. But now, thankx to the magic of Michaels 'close the stream suggestion', it works fine. 544 543 sendProcessStatus(new ConstructionEvent(this, GSStatus.HALTED, "killing the process")); 545 //prcs.getOutputStream().close();546 //prcs.destroy();547 ////status = ERROR;548 549 //return false;550 544 success = false; 551 545 } … … 752 746 } 753 747 754 ///System.out.println("@@@ GOT LINE: " + line);755 /// GS2PerlConstructor.logger.info("@@@ GOT LINE: " + line + " STDOUT=1: " + source); 748 ///System.out.println("@@@ GOT LINE: " + line); 749 756 750 757 751 //if(this.source == STDERR) { … … 814 808 bwHandle.write(line + "\n"); 815 809 816 /// System.out.println("@@@ WROTE LINE: " + line);817 810 /// GS2PerlConstructor.logger.info("@@@ WROTE LINE: " + line); 818 811
Note:
See TracChangeset
for help on using the changeset viewer.