Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 21 additions & 9 deletions lib/grunt.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,10 +111,16 @@ grunt.tasks = function(tasks, options, done) {
task.init(tasks, options);

verbose.writeln();
if (!tasksSpecified) {
verbose.writeln('No tasks specified, running default tasks.');

if (!grunt.cli.options.tasklist) {
if (!tasksSpecified) {
verbose.writeln('No tasks specified, running default tasks.');
}
verbose.writeflags(tasks, 'Running tasks');
}
else {
verbose.writeln('Listing registered tasks...\n');
}
verbose.writeflags(tasks, 'Running tasks');

// Handle otherwise unhandleable (probably asynchronous) exceptions.
var uncaughtHandler = function(e) {
Expand Down Expand Up @@ -147,10 +153,16 @@ grunt.tasks = function(tasks, options, done) {
}
});

// Execute all tasks, in order. Passing each task individually in a forEach
// allows the error callback to execute multiple times.
tasks.forEach(function(name) { task.run(name); });
// Run tasks async internally to reduce call-stack, per:
// https://github.com/gruntjs/grunt/pull/1026
task.start({asyncDone: true});
if (!grunt.cli.options.tasklist) {
// Execute all tasks, in order. Passing each task individually in a forEach
// allows the error callback to execute multiple times.
tasks.forEach(function(name) { task.run(name); });
// Run tasks async internally to reduce call-stack, per:
// https://github.com/gruntjs/grunt/pull/1026
task.start({asyncDone: true});
}
else {
// Do not run the registered tasks but just output them as JSON.
console.log(grunt.task._tasks);
}
};