Ignore:
Timestamp:
2010-07-28T15:06:55+12:00 (14 years ago)
Author:
kjdon
Message:

copied the pager code out of printusage and added it to print_single_{plugin,classifier} so that pluginfo and classinfo go to less

File:
1 edited

Legend:

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

    r22331 r22518  
    249249    }
    250250    else {
     251
     252    # this causes us to automatically send output to a pager, if one is
     253    # set, AND our output is going to a terminal
     254    # active state perl on windows doesn't do open(handle, "-|");
     255    if ($ENV{'GSDLOS'} !~ /windows/ && -t STDOUT) {
     256        my $pager = $ENV{"PAGER"};
     257        if (! $pager) {$pager="(less || more)"}
     258        my $pid = open(STDIN, "-|"); # this does a fork... see man perlipc(1)
     259        if (!defined $pid) {
     260        gsprintf(STDERR, "pluginfo.pl - can't fork: $!");
     261        } else {
     262        if ($pid != 0) { # parent (ie forking) process. child gets 0
     263            exec ($pager);
     264        }
     265        }
     266        open(STDERR,">&STDOUT"); # so it's easier to pipe output
     267    }
     268
    251269    gsprintf(STDERR, "\n{pluginfo.passing_options}\n\n");
    252270    gsprintf(STDERR, "{pluginfo.option_types}:\n\n");
Note: See TracChangeset for help on using the changeset viewer.