diff --git a/src/concurrently.js b/src/concurrently.js index 8f7d58b9..753728d9 100644 --- a/src/concurrently.js +++ b/src/concurrently.js @@ -64,11 +64,6 @@ module.exports = (commands, options) => { ); commands = handleResult.commands; - const commandsLeft = commands.slice(); - const maxProcesses = Math.max(1, Number(options.maxProcesses) || commandsLeft.length); - for (let i = 0; i < maxProcesses; i++) { - maybeRunMore(commandsLeft); - } if (options.logger) { const outputWriter = new OutputWriter({ @@ -79,6 +74,12 @@ module.exports = (commands, options) => { options.logger.observable.subscribe(({command, text}) => outputWriter.write(command, text)); } + const commandsLeft = commands.slice(); + const maxProcesses = Math.max(1, Number(options.maxProcesses) || commandsLeft.length); + for (let i = 0; i < maxProcesses; i++) { + maybeRunMore(commandsLeft); + } + return new CompletionListener({ successCondition: options.successCondition, })