Added autorun commands (fix #9)
This commit is contained in:
parent
40f63c1e2d
commit
a480a4cf4a
3 changed files with 38 additions and 2 deletions
|
|
@ -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");
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue