diff --git a/ChangeLog b/ChangeLog index 38dc7f85..3dcb60ba 100644 --- a/ChangeLog +++ b/ChangeLog @@ -8,6 +8,7 @@ - more tests - renamed VIPS_FOREIGN_DZ_DEPTH_1 as VIPS_FOREIGN_DZ_DEPTH_ONE etc. to help bindings +- vipsthumbnail will return an error code if one or more conversions failed 24/12/14 started 7.42.1 - add gobject-2.0 to Requires: in vips and vips-cpp .pc files diff --git a/man/vipsthumbnail.1 b/man/vipsthumbnail.1 index d589ad0b..0e488516 100644 --- a/man/vipsthumbnail.1 +++ b/man/vipsthumbnail.1 @@ -120,6 +120,8 @@ normally runs silently, except for warning and error messages. This option makes it print a list of the operations it performs on each image. .SH RETURN VALUE -returns 0 on success and non-zero on error. +returns 0 on success and non-zero on error. Error can mean one or more +conversions failed. + .SH SEE ALSO vipsheader(1) diff --git a/tools/vipsthumbnail.c b/tools/vipsthumbnail.c index 690d9c33..1104ed47 100644 --- a/tools/vipsthumbnail.c +++ b/tools/vipsthumbnail.c @@ -61,6 +61,8 @@ * 12/9/14 * - try with embedded profile first, if that fails retry with fallback * profile + * 13/1/15 + * - exit with an error code if one or more conversions failed */ #ifdef HAVE_CONFIG_H @@ -730,6 +732,7 @@ main( int argc, char **argv ) GOptionGroup *main_group; GError *error = NULL; int i; + int result; if( VIPS_INIT( argv[0] ) ) vips_error_exit( "unable to start VIPS" ); @@ -770,6 +773,8 @@ main( int argc, char **argv ) thumbnail_height = thumbnail_width; } + result = 0; + for( i = 1; i < argc; i++ ) { /* Hang resources for processing this thumbnail off @process. */ @@ -780,6 +785,11 @@ main( int argc, char **argv ) argv[0], argv[i] ); fprintf( stderr, "%s", vips_error_buffer() ); vips_error_clear(); + + /* We had a conversion failure: return an error code + * when we finally exit. + */ + result = -1; } g_object_unref( process ); @@ -787,5 +797,5 @@ main( int argc, char **argv ) vips_shutdown(); - return( 0 ); + return( result ); }