diff --git a/scopes/harmony/api-server/cli-raw.route.ts b/scopes/harmony/api-server/cli-raw.route.ts index 9b8afea1afa..4ff3b59bf18 100644 --- a/scopes/harmony/api-server/cli-raw.route.ts +++ b/scopes/harmony/api-server/cli-raw.route.ts @@ -29,13 +29,14 @@ export class CLIRawRoute implements Route { } const randomNumber = Math.floor(Math.random() * 10000); // helps to distinguish between commands in the log - const cmdStrLog = `${randomNumber} ${command}`; + const commandStr = command.join(' '); + const cmdStrLog = `${randomNumber} ${commandStr}`; await this.apiForIDE.logStartCmdHistory(cmdStrLog); legacyLogger.isDaemon = true; enableChalk(); const cliParser = new CLIParser(this.cli.commands, this.cli.groups, this.cli.onCommandStartSlot); try { - const commandRunner = await cliParser.parse(command.split(' ')); + const commandRunner = await cliParser.parse(command); const result = await commandRunner.runCommand(true); await this.apiForIDE.logFinishCmdHistory(cmdStrLog, 0); res.json(result); @@ -43,7 +44,7 @@ export class CLIRawRoute implements Route { if (err instanceof YargsExitWorkaround) { res.json({ data: err.helpMsg, exitCode: err.exitCode }); } else { - this.logger.error(`cli-raw server: got an error for ${command}`, err); + this.logger.error(`cli-raw server: got an error for ${commandStr}`, err); await this.apiForIDE.logFinishCmdHistory(cmdStrLog, 1); res.status(500); res.jsonp({ diff --git a/scopes/harmony/bit/server-commander.ts b/scopes/harmony/bit/server-commander.ts index 05ffaee5248..a0db8aff5b8 100644 --- a/scopes/harmony/bit/server-commander.ts +++ b/scopes/harmony/bit/server-commander.ts @@ -58,10 +58,9 @@ export class ServerCommander { if (!args.includes('--json') && !args.includes('-j')) { loader.on(); } - const command = args.join(' '); const endpoint = `cli-raw`; const pwd = process.cwd(); - const body = { command, pwd }; + const body = { command: args, pwd }; let res; try { res = await fetch(`${url}/${endpoint}`, { @@ -74,7 +73,7 @@ export class ServerCommander { await this.deleteServerPortFile(); throw new ServerNotFound(port); } - throw new Error(`failed to run command "${command}" on the server. ${err.message}`); + throw new Error(`failed to run command "${args.join(' ')}" on the server. ${err.message}`); } if (res.ok) {