Skip to content

Commit

Permalink
switch ordering of fallback
Browse files Browse the repository at this point in the history
  • Loading branch information
kenneth-marut-work committed Jul 2, 2021
1 parent d39e50c commit 96a1b61
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions packages/terminal/src/browser/terminal-widget-impl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
import { Terminal, RendererType } from 'xterm';
import { FitAddon } from 'xterm-addon-fit';
import { inject, injectable, named, postConstruct } from '@theia/core/shared/inversify';
import { ContributionProvider, Disposable, Event, Emitter, ILogger, DisposableCollection, MaybePromise } from '@theia/core';
import { ContributionProvider, Disposable, Event, Emitter, ILogger, DisposableCollection } from '@theia/core';
import { Widget, Message, WebSocketConnectionProvider, StatefulWidget, isFirefox, MessageLoop, KeyCode } from '@theia/core/lib/browser';
import { isOSX } from '@theia/core/lib/common';
import { WorkspaceService } from '@theia/workspace/lib/browser';
Expand Down Expand Up @@ -293,13 +293,16 @@ export class TerminalWidgetImpl extends TerminalWidget implements StatefulWidget
};
}

get cwd(): MaybePromise<URI> {
get cwd(): Promise<URI> {
if (!IBaseTerminalServer.validateId(this.terminalId)) {
return Promise.reject(new Error('terminal is not started'));
}
if (this.terminalService.getById(this.id)) {
return this.lastCwd || this.shellTerminalServer.getCwdURI(this.terminalId)
.then(cwdUrl => new URI(cwdUrl));
return this.shellTerminalServer.getCwdURI(this.terminalId)
.then(cwdUrl => {
this.lastCwd = new URI(cwdUrl);
return this.lastCwd;
}).catch(() => this.lastCwd);
}
return Promise.resolve(new URI());
}
Expand Down

0 comments on commit 96a1b61

Please sign in to comment.