• Binbin's avatar
    Fix redis-cli pubsub_mode and connect minor prompt / crash issue (#12571) · 4de4fcf2
    Binbin authored
    When entering pubsub mode and using the redis-cli only
    connect command, we need to reset pubsub_mode because
    we switch to a different connection.
    
    This will affect the prompt when the connection is successful,
    and redis-cli will crash when the connect fails:
    ```
    127.0.0.1:6379> subscribe ch
    1) "subscribe"
    2) "ch"
    3) (integer) 1
    127.0.0.1:6379(subscribed mode)> connect 127.0.0.1 6380
    127.0.0.1:6380(subscribed mode)> ping
    PONG
    127.0.0.1:6380(subscribed mode)> connect a b
    Could not connect to Redis at a:0: Name or service not known
    Segmentation fault
    ```
    4de4fcf2
redis-cli.c 372 KB