From 789441f22d9ad03d5752d28c24c7521e6475c1d4 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Vladim=C3=ADr=20=C4=8Cun=C3=A1t?= Date: Wed, 16 Sep 2020 13:10:44 +0200 Subject: [PATCH] daemon/io_tty_process_input: remove a special case After changes in this MR, sending an empty newline evaluates in lua as nil, and that seems fine. Let's drop this piece of code; it was broken now anyway (incorrect `io_mode_text` part). --- daemon/io.c | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/daemon/io.c b/daemon/io.c index 4fb10c1b7..1e5513471 100644 --- a/daemon/io.c +++ b/daemon/io.c @@ -501,18 +501,6 @@ void io_tty_process_input(uv_stream_t *stream, ssize_t nread, const uv_buf_t *bu } commands[nread] = '\0'; - const char *delim = args->quiet ? "" : "> "; - - /* No command, just new line */ - if (nread == 1 && (data->mode == io_mode_text) == false && commands[nread-1] == '\0' && data->blen == 0) { - if (stream_fd != STDIN_FILENO) { - fprintf(out, "%s", delim); - } - if (stream_fd == STDIN_FILENO || VERBOSE_STATUS) { - fprintf(stdout, "%s", delim); - } - } - char *boundary = "\n\0"; cmd = strtok(commands, "\n"); /* strtok skip '\n' but we need process alone '\n' too */ @@ -576,7 +564,9 @@ void io_tty_process_input(uv_stream_t *stream, ssize_t nread, const uv_buf_t *bu fwrite(message, len_s, 1, out); goto next_iter; } + /* Log to remote socket if connected */ + const char *delim = args->quiet ? "" : "> "; if (stream_fd != STDIN_FILENO) { if (VERBOSE_STATUS) fprintf(stdout, "%s\n", cmd); /* Duplicate command to logs */ -- 2.47.2