Ignore:
Timestamp:
2014-06-12T12:18:42+12:00 (10 years ago)
Author:
kjdon
Message:

new argument to print_txt_usage. Pass 1 if you don't want the output paged. We use this when there has been an error and we are outputing the options before quitting the import/build. If the output is paged, then the die doesn't end up getting through to the top level program. So for full-rebuild, if the import died because of a parsing error, if the output had been paged, then the import was stopped but the system return value was 0, and then it would go on to the next stage, trying to build. So now, if we are stopping because of an error, then don't page the output. Also added a few more (hopefully) helpful error messages

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/trunk/greenstone2/perllib/buildcolutils.pm

    r29079 r29096  
    8383  if ($intArgLeftinAfterParsing == -1)
    8484  {
    85     &PrintUsage::print_txt_usage($options, "{buildcol.params}");
     85    &PrintUsage::print_txt_usage($options, "{buildcol.params}",1);
     86    print STDERR "Something went wrong during parsing the arguments. Scroll up for details.\n";
    8687    die "\n";
    8788  }
     
    110111    &gsprintf::output_strings_in_UTF8;
    111112  }
    112 
     113 
     114  # If the user specified -h, then we output the usage
     115  if (@$argv && $argv->[0] =~ /^\-+h/) {
     116      &PrintUsage::print_txt_usage($options, "{buildcol.params}");
     117      die "\n";
     118  }
     119 
    113120  # now check that we had exactly one leftover arg, which should be
    114121  # the collection name. We don't want to do this earlier, cos
    115122  # -xml arg doesn't need a collection name
    116   # Or if the user specified -h, then we output the usage also
    117   if ($intArgLeftinAfterParsing != 1 || (@ARGV && $ARGV[0] =~ /^\-+h/))
    118   {
    119     &PrintUsage::print_txt_usage($options, "{buildcol.params}");
     123  if ($intArgLeftinAfterParsing != 1)
     124  {
     125    &PrintUsage::print_txt_usage($options, "{buildcol.params}", 1);
     126    print STDERR "There should be one argument left after parsing the script args: the collection name.\n";
    120127    die "\n";
    121128  }
     
    163170  if (($collection = &colcfg::use_collection($site, $collection, $collectdir)) eq "")
    164171  {
    165     &PrintUsage::print_txt_usage($options, "{buildcol.params}");
     172    #&PrintUsage::print_txt_usage($options, "{buildcol.params}", 1);
    166173    die "\n";
    167174  }
Note: See TracChangeset for help on using the changeset viewer.