Ignore:
Timestamp:
2017-04-06T19:15:55+12:00 (7 years ago)
Author:
ak19
Message:

In place of the Input- and OutputStreamGobbler classes, am now shifting GLI code to use SafeProcess too, copied across from GS3 src code. Class SafeProcess includes the two streamgobblers as static inner classes and some more functionality with safely running an external process from Java.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/trunk/gli/src/org/greenstone/gatherer/gui/FormatConversionDialog.java

    r30870 r31582  
    3131import org.greenstone.gatherer.cdm.CollectionConfigXMLReadWrite;
    3232import org.greenstone.gatherer.util.Codec;
    33 import org.greenstone.gatherer.util.InputStreamGobbler;
    34 import org.greenstone.gatherer.util.OutputStreamGobbler;
     33import org.greenstone.gatherer.util.SafeProcess;
    3534import org.greenstone.gatherer.util.StaticStrings;
    3635import org.greenstone.gatherer.util.XMLTools;
     
    317316      }*/
    318317
     318    SafeProcess prcs = new SafeProcess(command_args);
     319    prcs.setInputString(inputstr);
     320    prcs.setSplitStdErrorNewLines(true);
     321    prcs.runProcess();
     322    // process done, now get process output
     323    outputstr = prcs.getStdOutput();
     324    String errmsg = prcs.getStdError();
     325    if(!errmsg.equals("")) {
     326        System.err.println("*** Process errorstream: \n" + errmsg + "\n****");
     327    }
     328
     329    ///System.err.println("#### Got output: " + outputstr);
     330
     331    /*
    319332    try {       
    320333       
     
    363376        //ie.printStackTrace();
    364377    }
    365 
     378    */
    366379    return outputstr;
    367380    }
Note: See TracChangeset for help on using the changeset viewer.