Skip to content

Commit 5ebb096

Browse files
committed
Get terminals working
- Instead of a single listener per terminal that handles all events VS Code now has a single listener per event that handles that event for all terminals. - Refactor Terminal to extend TerminalProcess to avoid duplicating methods. This required some modifications to TerminalProcess to access the pid and title and to set the ID. - Remove our async change to shutdown. This was necessary to avoid disposing too early but shutdown already calls dispose so it turns out we didn't need to call it ourselves. - Rename methods to match the command strings. - Fix getting system shell (uses process.env). - Use a single bufferer. Since it already supports buffering for multiple terminals there's no need to have one per terminal. - Remove replay/reconnect logic. It's broken and unused so there doesn't seem much point in trying to refactor it to fit the changes right now. While terminals work now there are still a lot of todos.
1 parent b1fb9f7 commit 5ebb096

File tree

2 files changed

+134
-264
lines changed

2 files changed

+134
-264
lines changed

lib/vscode/src/vs/platform/terminal/node/terminalProcess.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,14 +45,13 @@ const enum ShutdownConstants {
4545
}
4646

4747
export class TerminalProcess extends Disposable implements ITerminalChildProcess {
48-
readonly id = 0;
4948
readonly shouldPersist = false;
5049

5150
private _exitCode: number | undefined;
5251
private _exitMessage: string | undefined;
5352
private _closeTimeout: any;
54-
private _ptyProcess: pty.IPty | undefined;
55-
private _currentTitle: string = '';
53+
protected _ptyProcess: pty.IPty | undefined;
54+
protected _currentTitle: string = '';
5655
private _processStartupComplete: Promise<void> | undefined;
5756
private _isDisposed: boolean = false;
5857
private _windowsShellHelper: WindowsShellHelper | undefined;
@@ -82,6 +81,7 @@ export class TerminalProcess extends Disposable implements ITerminalChildProcess
8281
public readonly onProcessShellTypeChanged = this._onProcessShellTypeChanged.event;
8382

8483
constructor(
84+
public readonly id: number = 0,
8585
private readonly _shellLaunchConfig: IShellLaunchConfig,
8686
cwd: string,
8787
cols: number,
@@ -293,9 +293,9 @@ export class TerminalProcess extends Disposable implements ITerminalChildProcess
293293
this._onProcessTitleChanged.fire(this._currentTitle);
294294
}
295295

296-
public async shutdown(immediate: boolean): Promise<void> {
296+
public shutdown(immediate: boolean): void {
297297
if (immediate) {
298-
await this._kill();
298+
this._kill();
299299
} else {
300300
if (!this._closeTimeout && !this._isDisposed) {
301301
this._queueProcessExit();

0 commit comments

Comments
 (0)