Correctly setting the return code

This commit is contained in:
WolverinDEV 2020-12-03 12:01:29 +01:00
parent 1305046df2
commit e5a74de831

View File

@ -48,10 +48,14 @@ class ErrorCommandHandler extends AbstractCommandHandler {
this.handle = handle; 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 = { const listener = {
callback: callback, callback: callback,
code: "rt-" + (++this.errorCodeIndex), code: returnCode,
timeout: 0, timeout: 0,
command: command command: command
} as ErrorCodeListener; } as ErrorCodeListener;
@ -334,7 +338,7 @@ export class ServerConnection extends AbstractServerConnection {
} else { } else {
reject(result); reject(result);
} }
}); }, data[0]["return_code"]);
try { try {
this.nativeHandle.send_command(command, data, options.flagset || []); this.nativeHandle.send_command(command, data, options.flagset || []);