Skip to content

Commit

Permalink
delay show until first output
Browse files Browse the repository at this point in the history
  • Loading branch information
haneefdm committed Sep 5, 2021
1 parent 2a4dc99 commit 7ecd959
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/frontend/server_console.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ export class GDBServerConsole {
protected toBackend: net.Socket = null;
protected toBackendPort: number = -1;
protected logFd = -1;
protected didShow = false;

public ptyTerm: PtyTerminal = null;
protected ptyOptions: IPtyTerminalOptions;
Expand All @@ -23,9 +24,6 @@ export class GDBServerConsole {
};
this.ptyOptions.name = GDBServerConsole.createTermName(this.ptyOptions.name, null);
this.setupTerminal();
setTimeout(() => {
this.ptyTerm.terminal.show();
}, 10);
try {
const tmpdir = os.platform() === 'win32' ? process.env.TEMP || process.env.TMP || '.' : '/tmp';
const fname = `${tmpdir}/gdb-server-console-${process.pid}`;
Expand All @@ -34,7 +32,15 @@ export class GDBServerConsole {
catch {}
}

public showIfFirstTime() {
if (this.ptyTerm && !this.didShow) {
this.ptyTerm.terminal.show();
this.didShow = true;
}
}

private setupTerminal() {
this.didShow = false;
this.ptyTerm = new PtyTerminal(this.ptyOptions);
this.ptyTerm.on('close', () => { this.onTerminalClosed(); });
this.ptyTerm.on('data', (data) => { this.sendToBackend(data); });
Expand Down Expand Up @@ -108,6 +114,7 @@ export class GDBServerConsole {
this.ptyTerm.pause();
});
socket.on('data', (data) => {
this.showIfFirstTime();
this.ptyTerm.write(data);
try {
if (this.logFd >= 0) {
Expand Down

0 comments on commit 7ecd959

Please sign in to comment.