Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add debug logs for reattaching to wrong terminal #186653

Merged
merged 1 commit into from
Jun 29, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/vs/platform/terminal/node/ptyService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,7 @@ export class PtyService extends Disposable implements IPtyService {
);
// Don't start the process here as there's no terminal to answer CPR
this._revivedPtyIdMap.set(terminal.id, { newId, state: terminal });
this._logService.info(`Revived process, old id ${terminal.id} -> new id ${newId}`);
}

@traceRpc
Expand Down Expand Up @@ -532,6 +533,7 @@ export class PtyService extends Disposable implements IPtyService {
private async _expandTerminalInstance(t: ITerminalInstanceLayoutInfoById): Promise<IRawTerminalInstanceLayoutInfo<IProcessDetails | null>> {
try {
const revivedPtyId = this._revivedPtyIdMap.get(t.terminal)?.newId;
this._logService.info(`Expanding terminal instance, old id ${t.terminal} -> new id ${revivedPtyId}`);
this._revivedPtyIdMap.delete(t.terminal);
const persistentProcessId = revivedPtyId ?? t.terminal;
const persistentProcess = this._throwIfNoPty(persistentProcessId);
Expand All @@ -542,6 +544,8 @@ export class PtyService extends Disposable implements IPtyService {
};
} catch (e) {
this._logService.warn(`Couldn't get layout info, a terminal was probably disconnected`, e.message);
this._logService.info('Reattach to wrong terminal debug info - layout info by id', t);
this._logService.info('Reattach to wrong terminal debug info - _revivePtyIdMap', Array.from(this._revivedPtyIdMap.values()));
// this will be filtered out and not reconnected
return {
terminal: null,
Expand Down