From: anthony Date: Sun, 20 May 2012 05:43:24 +0000 (+0000) Subject: Remove delegate spawn delay X-Git-Tag: 7.0.1-0~5567 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=2ec9bd9933ea84f813349d7ec9b61bf394142b4b;p=imagemagick Remove delegate spawn delay --- diff --git a/MagickCore/delegate.c b/MagickCore/delegate.c index 775358488..2567c93f4 100644 --- a/MagickCore/delegate.c +++ b/MagickCore/delegate.c @@ -926,7 +926,7 @@ MagickExport MagickBooleanType InvokeDelegate(ImageInfo *image_info, } if (AcquireUniqueFilename(image_info->zero) == MagickFalse) { - (void) RelinquishUniqueFileResource(image_info->zero); + (void) RelinquishUniqueFileResource(image_info->unique); ThrowFileException(exception,FileOpenError, "UnableToCreateTemporaryFile",image_info->zero); return(MagickFalse); @@ -1033,8 +1033,16 @@ MagickExport MagickBooleanType InvokeDelegate(ImageInfo *image_info, */ status=SystemCommand(delegate_info->spawn,image_info->verbose,command, exception) != 0 ? MagickTrue : MagickFalse; - if (delegate_info->spawn != MagickFalse) - (void) sleep(2); /* FUTURE: A better way is needed! */ + /* If spawn, wait for input file to 'disappear', or maximum 5 secs */ + if (delegate_info->spawn != MagickFalse) { +#if 1 + ssize_t count=50; /* 50 x 0.1 sec sleeps maximum */ + while( count > 0 && access_utf8(image->filename,F_OK) == 0 ) + (void) usleep(100000); /* sleep 0.1 seconds */ +#else + (void) sleep(2); +#endif + } command=DestroyString(command); } if (LocaleCompare(decode,"SCAN") != 0) diff --git a/MagickCore/property.c b/MagickCore/property.c index 4dea2145b..838211026 100644 --- a/MagickCore/property.c +++ b/MagickCore/property.c @@ -3039,16 +3039,11 @@ MagickExport char *InterpretImageProperties(const ImageInfo *image_info, } p++; /* advance beyond the percent */ - if ( *p == '\0' ) { - (void) ThrowMagickException(exception,GetMagickModule(), - OptionWarning,"UnknownImageProperty","\"%%\""); - p--; - continue; - } - /* - Doubled Percent + Doubled Percent - or percent at end of string */ + if ( *p == '\0' ) + p--; if ( *p == '%' ) { *q++='%'; continue; diff --git a/config/delegates.xml.in b/config/delegates.xml.in index e3f0d4e5a..cdd6e04b4 100644 --- a/config/delegates.xml.in +++ b/config/delegates.xml.in @@ -58,11 +58,19 @@ Set option delegate:bimodal=true to process bimodal delegates otherwise they are ignored. + + If stealth="True" the delegate is not listed in user requested + "-list delegate" listings. These are typically special internal delegates. + + If spawn="True" ImageMagick will not way for the delegate to finish, + nor will it read any output image. It will only wait for either the input + file to be removed (See "ephemeral:" coder) indicating that the input file + has been read, or a maximum time limit of 2 seconds. --> - +