From a4ddec7cd59ffa6924bd19bedae56765ee6ae758 Mon Sep 17 00:00:00 2001 From: kyusu Date: Thu, 26 Nov 2015 17:13:23 +0100 Subject: [PATCH] Abort grunt task if any error has occurred during rasterization - If an error occurs during rasterization the whole grunt build will hang. To prevent this, it is necessary to handle error and abort the grunt task via calling done. --- tasks/svg2png.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/tasks/svg2png.js b/tasks/svg2png.js index a0966b1..2c81bbb 100644 --- a/tasks/svg2png.js +++ b/tasks/svg2png.js @@ -116,7 +116,17 @@ module.exports = function(grunt) completed++; update(); } - } catch (e) { } + } catch (e) { + grunt.log.write("\n"); + grunt.log.error(e); + done(new Error("Rasterization failed!")); + } + }); + + spawn.stderr.on('data', function (buffer) { + grunt.log.write("\n"); + grunt.log.error(buffer); + done(new Error("Rasterization failed!")); }); spawn.on('exit', function()