Changeset 31585
- Timestamp:
- 2017-04-06T21:03:08+12:00 (7 years ago)
- Location:
- main/trunk/gli/src/org/greenstone/gatherer
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
main/trunk/gli/src/org/greenstone/gatherer/gui/DownloadPane.java
r31582 r31585 240 240 private ArrayList<String> loadDownloadersInfo(String lang) { 241 241 Document document = null; 242 Process process = null;243 242 244 243 try { … … 267 266 // Create the process. 268 267 args = (String []) args_list.toArray(new String[0]); 269 Runtime runtime = Runtime.getRuntime(); 268 269 SafeProcess process = new SafeProcess(args); 270 270 DebugStream.println("Getting Download Info: "+args_list); 271 process = runtime.exec(args); 272 273 InputStream input_stream = process.getErrorStream(); 274 document = XMLTools.parseXML(input_stream); 271 272 // run the SafeProcess 273 int exitVal = process.runProcess(); 274 if(exitVal != 0) { 275 throw new Exception("*** Error running Download Info process, process exited with: " 276 + exitVal); 277 } 278 279 // get the result and process it. 280 // This time we expect XML to have come out of the process std error stream. 281 String errStreamOutput = process.getStdError(); 282 StringReader xmlStrReader = new StringReader(errStreamOutput); 283 document = XMLTools.parseXML(xmlStrReader); 284 xmlStrReader.close(); 285 275 286 } 276 287 … … 280 291 System.err.println("Failed when trying to parse downloadinfo.pl -describeall"); 281 292 error.printStackTrace(); 282 }283 finally {284 SafeProcess.closeProcess(process);285 293 } 286 294 -
main/trunk/gli/src/org/greenstone/gatherer/util/SafeProcess.java
r31583 r31585 23 23 //static Logger logger = Logger.getLogger(org.greenstone.util.SafeProcess.class.getName()); 24 24 25 // input to SafeProcess and initialising it 25 26 private String command = null; 26 27 private String[] command_args = null; … … 29 30 private String inputStr = null; 30 31 32 // output from running SafeProcess.runProcess() 31 33 private String outputStr = ""; 32 34 private String errorStr = ""; 33 34 35 private int exitValue = -1; 35 36 … … 52 53 } 53 54 55 // cmd string version 54 56 public SafeProcess(String cmdStr) 55 57 {
Note:
See TracChangeset
for help on using the changeset viewer.