Ignore:
Timestamp:
2017-05-08T21:18:21+12:00 (7 years ago)
Author:
ak19
Message:

GS3 source code now updated to use SafeProcess instead of Process (calling Runtime.exec() directly). The use of SafeProcess in RunTarget and BrowserLauncher has been tested on Linux. GDBMWrapper, MapRetrieve and admin/guiext's Command.java are not tested. For GDBMWrapper, because it's in a bit of code that works with txtgz databases. MapRetrive.java and Command.java are untested because I don't know how to test them.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/trunk/greenstone3/src/java/org/greenstone/util/SafeProcess.java

    r31663 r31665  
    3333
    3434public class SafeProcess {
    35     public static int DEBUG = 0;
     35    public static int DEBUG = 1;
    3636
    3737    public static final int STDERR = 0;
     
    741741    SafeProcess prcs = new SafeProcess("which " + program);     
    742742    prcs.runProcess();
    743     String output = prcs.getStdOutput();
     743    String output = prcs.getStdOutput().trim();
     744    ///System.err.println("*** 'which " + program + "' returned: |" + output + "|");
    744745    if(output.equals("")) {
     746        return false;
     747    } else if(output.indexOf("no "+program) !=-1) { // from GS3's org.greenstone.util.BrowserLauncher.java's isAvailable(program)
     748        log("@@@ SafeProcess.isAvailable(): " + program + "is not available");
    745749        return false;
    746750    }
     
    10101014    logger.info(msg);
    10111015
    1012     //System.err.println(msg);
     1016    System.err.println(msg);
    10131017
    10141018    //DebugStream.println(msg);
     
    10191023    logger.error(msg, e);
    10201024
    1021     //System.err.println(msg);
    1022     //e.printStackTrace();
     1025    System.err.println(msg);
     1026    e.printStackTrace();
    10231027
    10241028    //DebugStream.println(msg);
     
    10301034    logger.error(e);
    10311035
    1032     //e.printStackTrace();
     1036    e.printStackTrace();
    10331037
    10341038    //DebugStream.printStackTrace(e);
Note: See TracChangeset for help on using the changeset viewer.