Fixed MONITOR mode and Issue 296

This commit is contained in:
antirez
2010-08-30 11:51:45 +02:00
parent 8fedd04dcc
commit e0e1c19520
2 changed files with 6 additions and 5 deletions

View File

@ -96,7 +96,7 @@ static sds cliReadLine(int fd) {
ssize_t ret;
ret = read(fd,&c,1);
if (ret == -1) {
if (ret <= 0) {
sdsfree(line);
return NULL;
} else if ((ret == 0) || (c == '\n')) {
@ -282,7 +282,8 @@ static int cliSendCommand(int argc, char **argv, int repeat) {
while(repeat--) {
anetWrite(fd,cmd,sdslen(cmd));
while (config.monitor_mode) {
cliReadSingleLineReply(fd,0);
if (cliReadSingleLineReply(fd,0)) exit(1);
printf("\n");
}
if (config.pubsub_mode) {