diff options
author | Guilhem Moulin <guilhem@fripost.org> | 2013-08-12 03:19:01 +0200 |
---|---|---|
committer | Guilhem Moulin <guilhem@fripost.org> | 2013-08-12 03:21:57 +0200 |
commit | 7602f1ecc28079adfd39488d34191ba1a442d058 (patch) | |
tree | ceec649776f4c6f3d0d035f404f4a2ab915ce5ed | |
parent | 2f5caa0110402a2cf878ce2da004950ceec572f4 (diff) |
Bugfix: Geo::GDAL::TermProgress_nocb uses STDOUT but we want STDERR.
-rwxr-xr-x | mkindex.pl | 21 |
1 files changed, 16 insertions, 5 deletions
@@ -183,9 +183,13 @@ use Geo::OSR; # http://www.imagemagick.org/script/perl-magick.php use Image::Magick; -my %config = ( progress => Geo::GDAL->can('TermProgress_nocb') ? - sub { Geo::GDAL::TermProgress_nocb(@_[0,1]) } : - *Geo::GDAL::TermProgress +my %config = ( progress => sub { + open *X, '>&', \*STDOUT or die "Can't dup STDOUT: $!"; + open STDOUT, '>&', STDERR or die "Can't dup STDERR: $!"; + Geo::GDAL::TermProgress_nocb(@_[0,1]); + open STDOUT, '>&', \*X or die "Can't dup X: $!"; + close *X; + } , debug => 0 , rename => 's/\.[^.]+$//' , outsize => [ 1024, 0 ] @@ -414,8 +418,14 @@ sub merge { (keys %$driver_opts); my @src_filenames = map {$_->{filename}} @mapset; - system 'gdalwarp', @opts, @src_filenames, $dst_filename; - $? == 0 or die "gdalwarp failed.\n"; + { + open *X, '>&', \*STDOUT or die "Can't dup STDOUT: $!"; + open STDOUT, '>&', STDERR or die "Can't dup STDERR: $!"; + system 'gdalwarp', @opts, @src_filenames, $dst_filename; + $? == 0 or die "gdalwarp failed.\n"; + open STDOUT, '>&', \*X or die "Can't dup X: $!"; + close *X; + } return $dst_filename; } @@ -477,6 +487,7 @@ sub annotate { $img->Composite( image => $text, compose => 'Over' ); undef $text; } + binmode STDOUT if $index =~ /^(?:[[:alnum:]]*:)?-$/; # Useful for pipes $img->Write($index); undef $img; } |