From: Mischa POSLAWSKY Date: Wed, 27 May 2020 17:48:12 +0000 (+0200) Subject: word edit: capture image convert error messages X-Git-Tag: v1.13~247 X-Git-Url: http://git.shiar.nl/sheet.git/commitdiff_plain/6b44d8dd46e71f06cc8575a272f65a523432147e word edit: capture image convert error messages --- diff --git a/writer.plp b/writer.plp index 5b81a20..9245915 100644 --- a/writer.plp +++ b/writer.plp @@ -210,11 +210,16 @@ elsif ($ENV{REQUEST_METHOD} eq 'POST') {{ '-strip', -quality => '60%', -interlace => 'plane', $imgpath => $thumbpath ); - my $status = system @cmds; - $status == 0 or Alert([ + eval { + require IPC::Run; + my $output; + IPC::Run::run(\@cmds, '<' => \undef, '>&' => \$output) + or die $output || + ($? & 127 ? "signal $?" : "error code ".($? >> 8))."\n"; + } or Alert([ "Thumbnail image not generated", - "Failed to convert source image, error code ".($status >> 8), - ], "@cmds"); + "Failed to convert source image.", + ], "@cmds\n$@"); } else { unlink $thumbpath;