Update e2e tests

- Tweak things on win for settings combinations which might
  work with all trouble you're getting from win versions and
  node-pty, etc.
- Relates #401
This commit is contained in:
Janne Valkealahti
2022-05-10 09:40:56 +01:00
parent 8af3bd892e
commit 1a1864f8c5
7 changed files with 4431 additions and 3105 deletions

View File

@@ -17,6 +17,7 @@ export class Cli {
private cols: number = 80;
private rows: number = 20;
private exit: Promise<number> | undefined;
private hasExit: boolean = false;
constructor(private options: CliOptions) {
if (options.keyWait) {
@@ -31,20 +32,22 @@ export class Cli {
}
public run(): void {
this.pty = pty.spawn(this.options.command, this.options.options || [], {
name: 'xterm-256color',
cols: this.cols,
rows: this.rows
});
this.term = new Terminal({
cols: this.cols,
rows: this.rows
});
this.pty = pty.spawn(this.options.command, this.options.options || [], {
name: 'xterm-256color',
cols: this.cols,
rows: this.rows,
useConpty: false
});
this.pty.onData(data => {
this.term?.write(data);
});
this.exit = new Promise(resolve => {
this.pty?.onExit(data => {
this.hasExit = true;
resolve(data.exitCode);
});
});
@@ -109,12 +112,12 @@ export class Cli {
if (this.isDisposed) {
return;
}
if (this.pty) {
this.pty.kill();
}
if (this.term) {
this.term.dispose();
try {
this.pty?.kill();
} catch (error) {
console.log(error);
}
this.term?.dispose();
this.isDisposed = true;
}