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;
}
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 || []);