From 7985b19d943366e27e14e23b61bd8316f530d9a7 Mon Sep 17 00:00:00 2001 From: Philip Zeyliger Date: Thu, 3 Oct 2019 09:56:54 -0700 Subject: [PATCH] Avoiding infinite loop on very long command names. If very long command names are registered, grunt --help runs out of memory trying to generate the help table. This commit adjusts the width to be at least 20 longer than the maximal command length. --- lib/grunt/help.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/grunt/help.js b/lib/grunt/help.js index c01f727da..d761ef565 100644 --- a/lib/grunt/help.js +++ b/lib/grunt/help.js @@ -12,7 +12,8 @@ exports.initCol1 = function(str) { }; exports.initWidths = function() { // Widths for options/tasks table output. - exports.widths = [1, col1len, 2, 76 - col1len]; + var commandWidth = Math.max(col1len + 20, 76); + exports.widths = [1, col1len, 2, commandWidth - col1len]; }; // Render an array in table form.