Changeset 24601
- Timestamp:
- 2011-09-15T18:28:42+12:00 (13 years ago)
- Location:
- main/trunk/greenstone2
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
main/trunk/greenstone2/bin/script/gs-magick.pl
r24600 r24601 128 128 #my $result = `$magick_cmd`; # This way will trap STDOUT into local variable 129 129 130 my $result = ""; 130 131 if (!open(PIN, "$magick_cmd |")) { 131 132 print STDERR "*** Can't run $magick_cmd. Error was: $!"; 133 } else { 134 while (defined (my $imagick_output_line = <PIN>)) { 135 $result = $result.$imagick_output_line; 136 } 137 close(PIN); 132 138 } 133 my $result = "";134 while (defined (my $imagick_output_line = <PIN>)) {135 $result = $result.$imagick_output_line;136 }137 close(PIN);138 139 139 140 # Perl Special Variables http://www.kichwa.com/quik_ref/spec_variables.html -
main/trunk/greenstone2/perllib/convertutil.pm
r24600 r24601 176 176 $had_error = 1; 177 177 178 # for imagemagick commands that go via gs-magick.pl, need to shift exit code by 8 and then179 # convert to its signed value to get the actual exit code that imagemagick had emitted.180 my $signed_cmd_status = $command_status;181 $ signed_cmd_status >>= 8;182 $ signed_cmd_status = (($signed_cmd_status & 0x80) ? -(0x100 - ($signed_cmd_status & 0xFF)) : $signed_cmd_status);183 184 print $outhandle "Error: processing command failed. Exit status $command_status (signed value: $signed_cmd_status)\n";178 # for commands that go via an intermediate layer (like commands to imagemagick go 179 # through gs-magick.pl), need to shift exit code by 8 and then convert to its 180 # signed value to get the actual exit code that imagemagick had emitted. 181 $command_status >>= 8; 182 $command_status = (($command_status & 0x80) ? -(0x100 - ($command_status & 0xFF)) : $command_status); 183 184 print $outhandle "Error: processing command failed. Exit status $command_status\n"; 185 185 186 186 if ($verbosity >= 3) { -
main/trunk/greenstone2/perllib/giget.pm
r24600 r24601 152 152 } 153 153 else { 154 my $command = "\"".&util::get_perl_exec()."\" -S gs-magick.pl identify \"$output_fname\" 2>&1"; 155 my $result = `$command`; 156 157 my $status = $?; 154 158 # need to shift the $? exit code returned by system() by 8 bits and 155 159 # then convert it to a signed value to work out whether it is indeed > 0 156 my $status = system("\"".&util::get_perl_exec()."\" -S gs-magick.pl identify \"$output_fname\""); 157 $status >>= 8; 158 $status = (($status & 0x80) ? -(0x100 - ($status & 0xFF)) : $status); 159 160 if($status > 0 ) { 160 #$status >>= 8; 161 #$status = (($status & 0x80) ? -(0x100 - ($status & 0xFF)) : $status); 162 #if($status > 0 ) { 163 if($status != 0 ) { 161 164 print STDERR "**** NOT JPEG: output_fname \n"; 162 165 unlink $output_fname; 163 166 } 164 167 else { 165 my $command = "\"".&util::get_perl_exec()."\" -S gs-magick.pl identify \"$output_fname\" 2>&1";166 my $result = `$command`;167 168 168 169 my $type = 'unknown';
Note:
See TracChangeset
for help on using the changeset viewer.