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/gsdl3/util/GDBMWrapper.java

    r31230 r31665  
    2929import java.util.ArrayList;
    3030
     31import org.greenstone.util.SafeProcess;
     32
    3133/**
    3234 * java wrapper class for gdbm - uses Java-GDBM written by Martin Pool replaces
     
    113115                                String cmdTest = "perl -v 2>&1";
    114116                                //String cmdTest = "echo %PATH%";
    115                                 int returnValue = Processing.runProcess(cmdTest);
     117                               
     118                                //int returnValue = Processing.runProcess(cmdTest);
     119
     120                                // replace Processing.java with SafeProcess.java
     121                                // so retain the same behaviour (logging)
     122                                SafeProcess process = new SafeProcess(cmdTest);
     123                                logger.error("executing command "+cmdTest);
     124                                int returnValue = process.runProcess();
     125                                // do something with the messages
     126                                logger.error("err>"+process.getStdError());
     127                                logger.error("out>"+process.getStdOutput());
     128                                process = null;
     129                               
    116130                                if (returnValue != 0)
    117131                                {
     
    122136
    123137                                String cmd = "perl -S txtgz-to-gdbm.pl \"" + txtgzFilename + "\" \"" + filename + "\"";
    124                                 returnValue = Processing.runProcess(cmd);
     138                                //returnValue = Processing.runProcess(cmd);
     139
     140                                // replace Processing.java with SafeProcess.java
     141                                // so retain the same behaviour (logging)
     142                                process = new SafeProcess(cmd);
     143                                logger.error("executing command "+cmd);
     144                                returnValue = process.runProcess();
     145                                // do something with the messages
     146                                logger.error("err>"+process.getStdError());
     147                                logger.error("out>"+process.getStdOutput());
     148                                process = null;
     149
    125150                                // For some reason, launching this command with gsdl_system() still returns 1
    126151                                // even when it returns 0 when run from the command-line. We can check whether
Note: See TracChangeset for help on using the changeset viewer.