diff --git a/src/runAll.js b/src/runAll.js index ab3ba8747..ce36e3f0d 100644 --- a/src/runAll.js +++ b/src/runAll.js @@ -54,6 +54,9 @@ module.exports = function runAll(config) { return `No staged files match ${task.pattern}` } return false + }, + hasStagedFiles: () => { + return task.fileList.length > 0 } })) @@ -62,7 +65,12 @@ module.exports = function runAll(config) { renderer } - if (tasks.length) { + let hasStagedTaskFiles = false; + tasks.forEach((task) => { + hasStagedTaskFiles = hasStagedTaskFiles || task.hasStagedFiles(); + }) + + if (hasStagedTaskFiles) { // Do not terminate main Listr process on SIGINT process.on('SIGINT', () => {})