Added autorun commands (fix #9)

This commit is contained in:
WebFreak001 2016-02-09 16:04:16 +01:00
commit a480a4cf4a
3 changed files with 38 additions and 2 deletions

View file

@ -318,6 +318,18 @@ export class MI2 extends EventEmitter implements IBackend {
this.emit("msg", type, msg[msg.length - 1] == '\n' ? msg : (msg + "\n"));
}
sendUserInput(command: string): Thenable<any> {
return new Promise((resolve, reject) => {
if (command.startsWith("-")) {
this.sendCommand(command.substr(1)).then(resolve, reject);
}
else {
this.sendRaw(command);
resolve(undefined);
}
});
}
sendRaw(raw: string) {
this.process.stdin.write(raw + "\n");
}