Skip to content

Commit

Permalink
Check if run callback is specific before setting it as the promise ha…
Browse files Browse the repository at this point in the history
…ndler

Fix #1086
  • Loading branch information
SBoudrias committed Jul 29, 2018
1 parent 392fd5d commit 1cd1031
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/index.js
Expand Up @@ -486,7 +486,11 @@ class Generator extends EventEmitter {
_.invokeMap(this._composedWith, 'run');
});

promise.then(cb, cb);
// Maintain backward compatibility with the callback function
if (_.isFunction(cb)) {
promise.then(cb, cb);
}

return promise;
}

Expand Down

0 comments on commit 1cd1031

Please sign in to comment.