Ignore:
Timestamp:
2011-09-15T16:31:11+12:00 (13 years ago)
Author:
ak19
Message:

Added gs-magick.pl script which will set the environment for ImageMagick (including LD_LIBRARY_PATH) before launching the requested ImageMagick command and arguments. By setting the Imagemagick environment from this script we ensure that the modified env variables don't create conflicts with libraries needed for normal linux execution. All the Greenstone files in the *binary* that made direct calls to imagemagick now go through this script. The affected files are perl files in bin/script and perllib and Gatherer.java of GLI. (wvware has files that test for imagemagick during compilation stage, which is independent of our changs which are only for users running imagemagick from a GS binary.) The final problems were related to how different perl files made use of the return values and the output of running their imagemagick command: they would query the 127 and/or and/or run the command with backtick operators to get the output printed to STDOUT. By inserting an intermediate gs-magick.pl file, needed to ensure that the exit code stored in 127 would at least be passed on correctly, as is necessary when testing the exit code against non-zero values or greater/less than zero (instead of comparing them with equals/not equal to 0). To get the correct exit code as emitted by imagemagick, calling code needs to shift bits in 127 and converting it to a signed value.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/trunk/greenstone2/bin/script/pdfpstoimg.pl

    r17328 r24600  
    8888    # with quoting when GSDLHOME might contain spaces) but assume
    8989    # that the PATH is set up correctly.
    90     $cmd = "convert";
     90    $cmd = "\"".&util::get_perl_exec()."\" -S gs-magick.pl convert";
    9191
    9292    my $output_filename = &util::filename_cat($output_filestem, $input_basename);
     
    100100    # note we return 0 if the file is "encrypted"
    101101    $!=0;
    102     if (system($cmd)!=0) {
     102    my $status = system($cmd);
     103    if ($status != 0) {
    103104    print STDERR "Convert error for $input_filename $!\n";
    104105    # leave these for gsConvert.pl...
Note: See TracChangeset for help on using the changeset viewer.