Skip to content

Commit

Permalink
stop mutating the arguments when calling multi
Browse files Browse the repository at this point in the history
This copies the arguments for a multi command instead of mutating the passed in arrays. This allows users to log the commands that gave an error if the multi command errors.
  • Loading branch information
reconbot committed Jun 5, 2017
1 parent d287fdc commit dcb9071
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lib/pipeline.js
Original file line number Diff line number Diff line change
Expand Up @@ -182,8 +182,9 @@ Pipeline.prototype.sendCommand = function (command) {
Pipeline.prototype.addBatch = function (commands) {
for (var i = 0; i < commands.length; ++i) {
var command = commands[i];
var commandName = command.shift();
this[commandName].apply(this, command);
var commandName = command[0];
var args = command.slice(1)
this[commandName].apply(this, args);
}

return this;
Expand Down

0 comments on commit dcb9071

Please sign in to comment.