Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,12 @@ import {
ClusterNodeRole, ClusterSingleNodeOptions,
CommandExecutionStatus,
} from 'src/modules/cli/dto/cli.dto';
import { checkRedirectionError, parseRedirectionError, splitCliCommandLine } from 'src/utils/cli-helper';
import {
checkHumanReadableCommands,
checkRedirectionError,
parseRedirectionError,
splitCliCommandLine,
} from 'src/utils/cli-helper';
import {
CommandNotSupportedError,
CommandParsingError,
Expand Down Expand Up @@ -63,8 +68,10 @@ export class WorkbenchCommandsExecutor {

try {
const [command, ...args] = splitCliCommandLine(commandLine);
const replyEncoding = checkHumanReadableCommands(`${command} ${args[0]}`) ? 'utf8' : undefined;

const response = this.formatter.format(
await this.redisTool.execCommand(clientOptions, command, args),
await this.redisTool.execCommand(clientOptions, command, args, replyEncoding),
);

this.logger.log('Succeed to execute workbench command.');
Expand Down Expand Up @@ -98,6 +105,7 @@ export class WorkbenchCommandsExecutor {
this.logger.log(`Executing redis.cluster CLI command for single node ${JSON.stringify(nodeOptions)}`);
try {
const [command, ...args] = splitCliCommandLine(commandLine);
const replyEncoding = checkHumanReadableCommands(`${command} ${args[0]}`) ? 'utf8' : undefined;

const nodeAddress = `${nodeOptions.host}:${nodeOptions.port}`;
let result = await this.redisTool.execCommandForNode(
Expand All @@ -106,6 +114,7 @@ export class WorkbenchCommandsExecutor {
args,
role,
nodeAddress,
replyEncoding,
);
if (result.error && checkRedirectionError(result.error) && nodeOptions.enableRedirection) {
const { slot, address } = parseRedirectionError(result.error);
Expand All @@ -115,6 +124,7 @@ export class WorkbenchCommandsExecutor {
args,
role,
address,
replyEncoding,
);
result.slot = parseInt(slot, 10);
}
Expand Down Expand Up @@ -155,9 +165,10 @@ export class WorkbenchCommandsExecutor {
this.logger.log(`Executing redis.cluster CLI command for [${role}] nodes.`);
try {
const [command, ...args] = splitCliCommandLine(commandLine);
const replyEncoding = checkHumanReadableCommands(`${command} ${args[0]}`) ? 'utf8' : undefined;

return (
await this.redisTool.execCommandForNodes(clientOptions, command, args, role)
await this.redisTool.execCommandForNodes(clientOptions, command, args, role, replyEncoding)
).map((nodeExecReply) => {
const {
response, status, host, port,
Expand Down