Skip to content

Commit

Permalink
Merge pull request #322 from KxSystems/fix-write-console
Browse files Browse the repository at this point in the history
improve the code
  • Loading branch information
Philip-Carneiro-KX authored May 24, 2024
2 parents 1619e01 + 373e487 commit 8807763
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/commands/serverCommand.ts
Original file line number Diff line number Diff line change
Expand Up @@ -570,9 +570,9 @@ export function writeQueryResultsToConsole(
duration?: string,
): void {
const queryConsole = ExecutionConsole.start();
const res = Array.isArray(result)
? decodeQUTF(result[0])
: decodeQUTF(result);
const isNonEmptyArray = Array.isArray(result) && result.length > 0;
const valueToDecode = isNonEmptyArray ? result[0] : result.toString();
const res = decodeQUTF(valueToDecode);
if (!res.startsWith(queryConstants.error)) {
queryConsole.append(
res,
Expand Down

0 comments on commit 8807763

Please sign in to comment.