Ignore:
Timestamp:
2007-05-24T16:31:21+12:00 (17 years ago)
Author:
xiao
Message:

Instead of using the exitValue, now it uses the standard output phrase to detect the installation of ImageMagick

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/gli/src/org/greenstone/gatherer/Gatherer.java

    r14088 r14093  
    972972        Process image_magick_process = Runtime.getRuntime().exec(command);
    973973        image_magick_process.waitFor();
    974         return (image_magick_process.exitValue() == 0);
     974       
     975        //new way of detection of ImageMagick
     976        InputStreamReader isr = new InputStreamReader(image_magick_process.getInputStream());
     977            BufferedReader br = new BufferedReader(isr);
     978            // Capture the standard output stream and seach for two particular occurances: Version and ImageMagick.
     979            String line = br.readLine().toLowerCase();
     980        if (line.indexOf("version") != -1 || line.indexOf("imagemagick") != -1) {
     981            return true;
     982        } else {
     983                return false;
     984        }
     985        //return (image_magick_process.exitValue() == 0);
    975986        }
    976987        catch (IOException exception) {
Note: See TracChangeset for help on using the changeset viewer.