From e5a74de83199b1124f95345b6cfb901a4a283c78 Mon Sep 17 00:00:00 2001 From: WolverinDEV Date: Thu, 3 Dec 2020 12:01:29 +0100 Subject: [PATCH] Correctly setting the return code --- modules/renderer/connection/ServerConnection.ts | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/modules/renderer/connection/ServerConnection.ts b/modules/renderer/connection/ServerConnection.ts index 5f69b12..47148de 100644 --- a/modules/renderer/connection/ServerConnection.ts +++ b/modules/renderer/connection/ServerConnection.ts @@ -48,10 +48,14 @@ class ErrorCommandHandler extends AbstractCommandHandler { this.handle = handle; } - generateReturnCode(command: string, callback: (result: CommandResult) => void) : string { + generateReturnCode(command: string, callback: (result: CommandResult) => void, returnCode?: string) : string { + if(typeof returnCode === "undefined") { + returnCode = "rt-" + (++this.errorCodeIndex); + } + const listener = { callback: callback, - code: "rt-" + (++this.errorCodeIndex), + code: returnCode, timeout: 0, command: command } as ErrorCodeListener; @@ -334,7 +338,7 @@ export class ServerConnection extends AbstractServerConnection { } else { reject(result); } - }); + }, data[0]["return_code"]); try { this.nativeHandle.send_command(command, data, options.flagset || []);