From e6ccb777a3ac020fed1f6b9c9f5001b416db7eb5 Mon Sep 17 00:00:00 2001 From: Shuduo Sang Date: Thu, 9 Feb 2023 22:24:45 +0800 Subject: [PATCH] fix: taos shell show err msg twice with cloud service (#19894) --- tools/shell/src/shellWebsocket.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/tools/shell/src/shellWebsocket.c b/tools/shell/src/shellWebsocket.c index add3ccc51f..b93cc02964 100644 --- a/tools/shell/src/shellWebsocket.c +++ b/tools/shell/src/shellWebsocket.c @@ -218,8 +218,13 @@ void shellRunSingleCommandWebsocketImp(char *command) { res = ws_query_timeout(shell.ws_conn, command, shell.args.timeout); int code = ws_errno(res); if (code != 0 && !shell.stop_query) { - et = taosGetTimestampUs(); - fprintf(stderr, "\nDB: error: %s (%.6fs)\n", ws_errstr(res), (et - st)/1E6); + // websocket interface masked off first bit from standard error number. + if (TSDB_CODE_PAR_SYNTAX_ERROR == (code|0x80000000)) { + et = taosGetTimestampUs(); + fprintf(stderr, "\nDB: error: %s (%.6fs)\n", ws_errstr(res), (et - st)/1E6); + ws_free_result(res); + return; + } if (code == TSDB_CODE_WS_SEND_TIMEOUT || code == TSDB_CODE_WS_RECV_TIMEOUT) { fprintf(stderr, "Hint: use -t to increase the timeout in seconds\n"); } else if (code == TSDB_CODE_WS_INTERNAL_ERRO || code == TSDB_CODE_WS_CLOSED) { -- GitLab