Skip to content

Commit

Permalink
Don't wait for 4s orphan check for just revived processes
Browse files Browse the repository at this point in the history
Fixes #133964
  • Loading branch information
Tyriar committed Nov 15, 2021
1 parent 4a7cd94 commit f76b133
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/vs/platform/terminal/node/ptyService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -342,9 +342,10 @@ export class PtyService extends Disposable implements IPtyService {

private async _expandTerminalInstance(t: ITerminalInstanceLayoutInfoById): Promise<IRawTerminalInstanceLayoutInfo<IProcessDetails | null>> {
try {
const persistentProcessId = this._revivedPtyIdMap.get(t.terminal)?.newId ?? t.terminal;
const revivedPtyId = this._revivedPtyIdMap.get(t.terminal)?.newId;
const persistentProcessId = revivedPtyId ?? t.terminal;
const persistentProcess = this._throwIfNoPty(persistentProcessId);
const processDetails = persistentProcess && await this._buildProcessDetails(t.terminal, persistentProcess);
const processDetails = persistentProcess && await this._buildProcessDetails(t.terminal, persistentProcess, revivedPtyId !== undefined);
return {
terminal: { ...processDetails, id: persistentProcessId } ?? null,
relativeSize: t.relativeSize
Expand All @@ -359,8 +360,10 @@ export class PtyService extends Disposable implements IPtyService {
}
}

private async _buildProcessDetails(id: number, persistentProcess: PersistentTerminalProcess): Promise<IProcessDetails> {
const [cwd, isOrphan] = await Promise.all([persistentProcess.getCwd(), persistentProcess.isOrphaned()]);
private async _buildProcessDetails(id: number, persistentProcess: PersistentTerminalProcess, wasRevived: boolean = false): Promise<IProcessDetails> {
// If the process was just revived, don't do the orphan check as it will
// take some time
const [cwd, isOrphan] = await Promise.all([persistentProcess.getCwd(), wasRevived ? true : persistentProcess.isOrphaned()]);
return {
id,
title: persistentProcess.title,
Expand Down

0 comments on commit f76b133

Please sign in to comment.