Skip to content

Commit 9922b1c

Browse files
committed
Improve logging of pty host startup/reconnection
1 parent ce3f06b commit 9922b1c

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

src/vs/platform/terminal/node/ptyHostService.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import { Disposable, toDisposable } from 'vs/base/common/lifecycle';
88
import { IProcessEnvironment, OperatingSystem, isWindows } from 'vs/base/common/platform';
99
import { ProxyChannel } from 'vs/base/parts/ipc/common/ipc';
1010
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
11-
import { ILogService, ILoggerService } from 'vs/platform/log/common/log';
11+
import { ILogService, ILoggerService, LogLevel } from 'vs/platform/log/common/log';
1212
import { RemoteLoggerChannelClient } from 'vs/platform/log/common/logIpc';
1313
import { getResolvedShellEnv } from 'vs/platform/shell/node/shellEnv';
1414
import { IPtyHostProcessReplayEvent } from 'vs/platform/terminal/common/capabilities/capabilities';
@@ -139,6 +139,11 @@ export class PtyHostService extends Disposable implements IPtyService {
139139
const connection = this._ptyHostStarter.start();
140140
const client = connection.client;
141141

142+
// Log a full stack trace which will tell the exact reason the pty host is starting up
143+
if (this._logService.getLevel() === LogLevel.Trace) {
144+
this._logService.trace('PtyHostService#_startPtyHost', new Error().stack?.replace(/^Error/, ''));
145+
}
146+
142147
// Setup heartbeat service and trigger a heartbeat immediately to reset the timeouts
143148
const heartbeatService = ProxyChannel.toService<IHeartbeatService>(client.getChannel(TerminalIpcChannels.Heartbeat));
144149
heartbeatService.onBeat(() => this._handleHeartbeat());

src/vs/workbench/contrib/terminal/browser/terminalService.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -422,7 +422,7 @@ export class TerminalService implements ITerminalService {
422422
private _setConnected() {
423423
this._connectionState = TerminalConnectionState.Connected;
424424
this._onDidChangeConnectionState.fire();
425-
this._logService.trace('Reconnected to terminals');
425+
this._logService.trace('Pty host ready to use');
426426
}
427427

428428
private async _reconnectToRemoteTerminals(): Promise<void> {
@@ -444,6 +444,8 @@ export class TerminalService implements ITerminalService {
444444
// now that terminals have been restored,
445445
// attach listeners to update remote when terminals are changed
446446
this._attachProcessLayoutListeners();
447+
448+
this._logService.trace('Reconnected to remote terminals');
447449
}
448450

449451
private async _reconnectToLocalTerminals(): Promise<void> {
@@ -462,6 +464,8 @@ export class TerminalService implements ITerminalService {
462464
// now that terminals have been restored,
463465
// attach listeners to update local state when terminals are changed
464466
this._attachProcessLayoutListeners();
467+
468+
this._logService.trace('Reconnected to local terminals');
465469
}
466470

467471
private _recreateTerminalGroups(layoutInfo?: ITerminalsLayoutInfo): Promise<ITerminalGroup[]> {

0 commit comments

Comments
 (0)