Created
December 18, 2015 21:39
-
-
Save palmerj3/a98c8b303d24d04e875f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var oldRunTaskFn = grunt.util.task.Task.prototype.runTaskFn; | |
grunt.util.task.Task.prototype.runTaskFn = function () { | |
var taskName = arguments[0].name | |
var invokeFn = arguments[1]; | |
var asyncFn = arguments[2]; | |
var start = (new Date()).getTime(); | |
// New Async "Done" function | |
var newAsyncFn = function () { | |
fs.appendFileSync('.tmpBuildSteps', [start, (new Date()).getTime(), taskName].join(',') + '\n'); | |
asyncFn.apply(this, arguments); | |
} | |
// Overwrite function argument | |
// So we can track when task completes | |
if (typeof asyncFn === 'function') { | |
arguments[2] = newAsyncFn; | |
} | |
// Call original | |
oldRunTaskFn.apply(this, arguments); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment