Skip to content

Commit

Permalink
Fix SCRIPT EXISTS arity (#1567)
Browse files Browse the repository at this point in the history
This is a minor fix, SCRIPT EXISTS requires at least
three arguments.

Before the change, we can do this:

```
127.0.0.1:6666> script exists
(empty array)
```

After: we will return the wrong number of arguments error.
  • Loading branch information
enjoy-binbin authored and git-hulk committed Aug 1, 2023
1 parent 52ab792 commit f59c605
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/commands/cmd_script.cc
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ class CommandScript : public Commander {
return s;
}
*output = redis::SimpleString("OK");
} else if (args_.size() >= 2 && subcommand_ == "exists") {
} else if (args_.size() >= 3 && subcommand_ == "exists") {
*output = redis::MultiLen(args_.size() - 2);
for (size_t j = 2; j < args_.size(); j++) {
if (svr->ScriptExists(args_[j]).IsOK()) {
Expand Down

0 comments on commit f59c605

Please sign in to comment.