tasks/debug.js
function(name, brk, debugChildren) {
		var deferred = Q.defer();
		var args = process.argv;
		
		grunt.task.clearQueue();
		
		var tasks = args.slice(args.indexOf(name) + 1);
		
		if (debugChildren) {
			tasks.unshift('debug:hook' + (brk ? '-break' : ''));
		}
		
		var child = child_process.fork(
			args[1],
			tasks,
			{
				execArgv: [
					brk
						? '--debug-brk'
						: '--debug'
				]
			}
		);
		
		child.on('exit', function(code) {
			if (code == 0) {
				deferred.resolve();
			}
			else {
				deferred.reject(code);
			}
		});
		
		return deferred.promise;
	}
function(name, brk, debugChildren) {
		var deferred = Q.defer();
		var args = process.argv;
		
		grunt.task.clearQueue();
		
		var tasks = args.slice(args.indexOf(name) + 1);
		
		if (debugChildren) {
			tasks.unshift('debug:hook' + (brk ? '-break' : ''));
		}
		
		var child = child_process.fork(
			args[1],
			tasks,
			{
				execArgv: [
					brk
						? '--debug-brk'
						: '--debug'
				]
			}
		);
		
		child.on('exit', function(code) {
			if (code == 0) {
				deferred.resolve();
			}
			else {
				deferred.reject(code);
			}
		});
		
		return deferred.promise;
	}
function ( name , brk , debugChildren ) { var deferred = Q . defer ( ) ; var args = process . argv ; grunt . task . clearQueue ( ) ; var tasks = args . slice ( args . indexOf ( name ) + 1 ) ; if ( debugChildren ) { tasks . unshift ( 'debug:hook' + ( brk ? '-break' : '' ) ) ; } var child = child_process . fork ( args [ 1 ] , tasks , { execArgv : [ brk ? '--debug-brk' : '--debug' ] } ) ; child . on ( 'exit' , function ( code ) { if ( code == 0 ) { deferred . resolve ( ) ; } else { deferred . reject ( code ) ; } } ) ; return deferred . promise ; }
Manually forks the Grunt process for debugging
Manually forks the Grunt process for debugging