Skip to content

Commit

Permalink
Avoiding infinite loop on very long command names.
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
philz committed Oct 3, 2019
1 parent 75da17b commit 7985b19
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/grunt/help.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit 7985b19

Please sign in to comment.