grunt icon indicating copy to clipboard operation
grunt copied to clipboard

Ignore functions within patterns

Open shama opened this issue 11 years ago • 0 comments

If you have a task that is configured to read targets as functions, it works fine. But when verbose is enabled, the function gets treated as a src array here: https://github.com/shama/grunt/blob/master/lib/grunt/task.js#L199

and produces the error:

TypeError: Object function () {
      } has no method 'indexOf'
    at /Users/Kyle/Documents/www/grunt-gulp/node_modules/grunt/lib/grunt/file.js:55:29
    at Array.forEach (native)
    at processPatterns (/Users/Kyle/Documents/www/grunt-gulp/node_modules/grunt/lib/grunt/file.js:53:34)
    at Object.file.expand (/Users/Kyle/Documents/www/grunt-gulp/node_modules/grunt/lib/grunt/file.js:110:17)
    at Object.fn [as src] (/Users/Kyle/Documents/www/grunt-gulp/node_modules/grunt/lib/grunt/task.js:180:36)
    at /Users/Kyle/Documents/www/grunt-gulp/node_modules/grunt/lib/grunt/task.js:199:24
    at Array.forEach (native)
    at Task.task.normalizeMultiTaskFiles (/Users/Kyle/Documents/www/grunt-gulp/node_modules/grunt/lib/grunt/task.js:196:11)

This PR just ignores any pattern that is a function as I think that is the most robust way to avoid hitting this hard error. Thanks!

Ref shama/grunt-gulp#1

shama avatar Oct 15 '14 22:10 shama