- Timestamp:
- 2017-05-08T21:18:21+12:00 (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/trunk/greenstone3/src/java/org/greenstone/util/BrowserLauncher.java
r22085 r31665 7 7 import org.greenstone.server.BaseProperty; 8 8 import org.greenstone.util.Misc; 9 import org.greenstone.util.SafeProcess; 9 10 import org.apache.log4j.*; 10 11 … … 50 51 // we try to look for a browser 51 52 for (int i=0; i<default_browsers.length; i++) { 52 if ( isAvailable(default_browsers[i])) {53 if (SafeProcess.isAvailable(default_browsers[i])) { 53 54 this.command = default_browsers[i] + " %1"; 54 55 break; … … 60 61 } 61 62 63 // Replaced by SafeProcess.isAvailable(program) 64 /* 62 65 protected boolean isAvailable(String program) { 63 66 try { … … 76 79 return false; 77 80 } 78 } 81 }*/ 79 82 80 83 public int getBrowserState(){ … … 100 103 logger.info(new_command); 101 104 Runtime rt = Runtime.getRuntime(); 102 Process process = rt.exec(new_command);105 //Process process = rt.exec(new_command); 103 106 state = LAUNCHSUCCESS; 104 exitCode = process.waitFor(); 107 //exitCode = process.waitFor(); 108 SafeProcess process = new SafeProcess(new_command); 109 exitCode = process.runProcess(); 110 process = null; 105 111 logger.info("ExitCode:" + exitCode); 106 112 if (exitCode != 0) { // if Netscape or mozilla was not open 107 113 logger.info("couldn't do remote, trying original command"); 108 114 logger.info(this.command); 109 process = rt.exec(this.command); // try the original command115 //process = rt.exec(this.command); // try the original command 110 116 state = LAUNCHSUCCESS; 111 117 //for some reason the following part is not executed sometimes. 112 exitCode = process.waitFor(); 118 //exitCode = process.waitFor(); 119 process = new SafeProcess(this.command); 120 exitCode = process.runProcess(); 121 process = null; 113 122 } 114 123 } else { 115 124 logger.info(this.command); 116 125 Runtime rt = Runtime.getRuntime(); 117 Process process = rt.exec(this.command);126 //Process process = rt.exec(this.command); 118 127 state = LAUNCHSUCCESS; 119 128 //for some reason the following part is not executed sometimes. 120 exitCode = process.waitFor(); 129 //exitCode = process.waitFor(); 130 SafeProcess process = new SafeProcess(this.command); 131 exitCode = process.runProcess(); 121 132 } 122 133
Note:
See TracChangeset
for help on using the changeset viewer.