From ae77016e572bc5ed48574c3a173c4cda27c5e0d9 Mon Sep 17 00:00:00 2001 From: Pieter Noordhuis Date: Wed, 25 Aug 2010 13:39:11 +0200 Subject: [PATCH 1/1] Add a newline to tty output after every reply --- src/redis-cli.c | 10 +++------- tests/integration/redis-cli.tcl | 2 ++ 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/src/redis-cli.c b/src/redis-cli.c index 33919758..df4c2517 100644 --- a/src/redis-cli.c +++ b/src/redis-cli.c @@ -226,7 +226,7 @@ static int cliReadReply(int fd) { case '*': return cliReadMultiBulkReply(fd); default: - printf("protocol error, got '%c' as reply type byte\n", type); + printf("protocol error, got '%c' as reply type byte", type); return 1; } } @@ -294,12 +294,8 @@ static int cliSendCommand(int argc, char **argv, int repeat) { } retval = cliReadReply(fd); - if (retval) { - return retval; - } - if (!config.raw_output && config.tty) { - printf("\n"); - } + if (!config.raw_output && config.tty) printf("\n"); + if (retval) return retval; } return 0; } diff --git a/tests/integration/redis-cli.tcl b/tests/integration/redis-cli.tcl index c4954304..4f180daf 100644 --- a/tests/integration/redis-cli.tcl +++ b/tests/integration/redis-cli.tcl @@ -36,9 +36,11 @@ start_server {tags {"cli"}} { } proc test_interactive_cli {name code} { + set ::env(FAKETTY) 1 set fd [open_cli] test "Interactive CLI: $name" $code close_cli $fd + unset ::env(FAKETTY) } proc run_nontty_cli {args} { -- 2.45.2