tasks/lib/hooks.js
function(grunt) {
		var me = this;
		
		this.hookChild(
			grunt.util,
			'spawn',
			function(original, spawnArgs) {
				var options = spawnArgs[0];
				var callback = spawnArgs[1];
				
				if (options.cmd === process.argv[0]) {
					var module;
					
					for (var i = 0; i < options.args.length; i++) {
						if (options.args[i].lastIndexOf('--') != 0) {
							module = options.args[i];
							break;
						}
					}
					
					me.addDebugArg(options.args, module);
				}
				
				return original.call(this, options, callback);
			}
		);
	}
function(grunt) {
		var me = this;
		
		this.hookChild(
			grunt.util,
			'spawn',
			function(original, spawnArgs) {
				var options = spawnArgs[0];
				var callback = spawnArgs[1];
				
				if (options.cmd === process.argv[0]) {
					var module;
					
					for (var i = 0; i < options.args.length; i++) {
						if (options.args[i].lastIndexOf('--') != 0) {
							module = options.args[i];
							break;
						}
					}
					
					me.addDebugArg(options.args, module);
				}
				
				return original.call(this, options, callback);
			}
		);
	}
function ( grunt ) { var me = this ; this . hookChild ( grunt . util , 'spawn' , function ( original , spawnArgs ) { var options = spawnArgs [ 0 ] ; var callback = spawnArgs [ 1 ] ; if ( options . cmd === process . argv [ 0 ] ) { var module ; for ( var i = 0 ; i < options . args . length ; i ++ ) { if ( options . args [ i ] . lastIndexOf ( '--' ) != 0 ) { module = options . args [ i ] ; break ; } } me . addDebugArg ( options . args , module ) ; } return original . call ( this , options , callback ) ; } ) ; }
Monkey-patch grunt `spawn` function to enable debugging on child processes.
Monkey - patch grunt spawn function to enable debugging on child processes .