- Timestamp:
- 2017-04-21T21:09:08+12:00 (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/trunk/gli/src/org/greenstone/gatherer/collection/ScriptOptions.java
r20924 r31636 11 11 import org.greenstone.gatherer.util.ArrayTools; 12 12 import org.greenstone.gatherer.util.Codec; 13 import org.greenstone.gatherer.util.SafeProcess; 13 14 import org.greenstone.gatherer.util.Utility; 14 15 import org.greenstone.gatherer.util.XMLTools; … … 238 239 args[5] = lang; 239 240 240 241 241 // Create the process. 242 Runtime runtime = Runtime.getRuntime(); 243 Process process = runtime.exec(args); 244 245 242 SafeProcess process = new SafeProcess(args); 243 246 244 //for (int i=0; i<args.length; i++) { 247 245 // System.err.print(args[i] + " "); … … 249 247 //System.err.println(""); 250 248 251 252 253 document = XMLTools.parseXML(process.getErrorStream()); 249 // run the SafeProcess 250 int exitVal = process.runProcess(); 251 if(exitVal != 0) { 252 throw new Exception("*** Error running ScriptOptions process, process exited with: " 253 + exitVal); 254 } 254 255 256 // get the result and process it. 257 // We expect XML to have come out of the process std error stream. 258 String errStreamOutput = process.getStdError(); 259 ///System.err.println("*********\nScriptOptions data, got:\n" + errStreamOutput + "\n**********\n"); 260 StringReader xmlStrReader = new StringReader(errStreamOutput); 261 document = XMLTools.parseXML(xmlStrReader); 262 xmlStrReader.close(); 263 264 255 265 if (document == null) { 256 266 // command has not generated XML, script has probably failed in some way
Note:
See TracChangeset
for help on using the changeset viewer.