diff --git a/src/backend/mi2/mi2.ts b/src/backend/mi2/mi2.ts index 2b6cfbf..e29221d 100644 --- a/src/backend/mi2/mi2.ts +++ b/src/backend/mi2/mi2.ts @@ -573,15 +573,13 @@ export class MI2 extends EventEmitter implements IBackend { } sendUserInput(command: string): Thenable { - return new Promise((resolve, reject) => { - if (command.startsWith("-")) { - this.sendCommand(command.substr(1)).then(resolve, reject); - } - else { - this.sendRaw(command); - resolve(undefined); - } - }); + if (command.startsWith("-")) { + return this.sendCommand(command.substr(1)); + } + else { + this.sendRaw(command); + return Promise.resolve(undefined); + } } sendRaw(raw: string) { diff --git a/src/mibase.ts b/src/mibase.ts index 13ec0a3..6c0a9bc 100644 --- a/src/mibase.ts +++ b/src/mibase.ts @@ -348,8 +348,16 @@ export class MI2DebugSession extends DebugSession { }); else { this.miDebugger.sendUserInput(args.expression).then(output => { - if (output) - response.body.result = JSON.stringify(output); + if (typeof output == "undefined") + response.body = { + result: "", + variablesReference: 0 + }; + else + response.body = { + result: JSON.stringify(output), + variablesReference: 0 + }; this.sendResponse(response); }, msg => { this.sendErrorResponse(response, 8, msg.toString());