redis-cli should imho return non-zero exit code, in case of unknown command or bad syntax.
# redis-cli EXIST foo; echo $? (error) ERR unknown command 'EXIST' 0 # redis-cli --version redis-cli 3.2.1
Comment From: TrentonAdams
I have a partial fix on master at git@github.com:TrentonAdams/redis.git
However, keep in mind that it now prints the error twice, and I don't know why. Perhaps a regular dev would figure that out in a minute or two?
$ ./redis-cli -h 127.0.0.1 -p 6380 incr counter
(error) READONLY You can't write against a read only replica.
(error) READONLY You can't write against a read only replica.
22:38:46 [trenta@trent-pc:~/Documents/development/redis/src] unstable(+1/-2)* 255 ±
$ echo $?
255
Comment From: TrentonAdams
Oh, crap that doesn't fix the example given in the issue though.
Comment From: itamarhaber
Looks like this was resolved (albeit a little differently) via #8136 - closing for now.