@@ -31,6 +31,7 @@ import { ITerminalInstanceService } from 'vs/workbench/contrib/terminal/browser/
31
31
import { TerminalCapabilityStore } from 'vs/workbench/contrib/terminal/common/capabilities/terminalCapabilityStore' ;
32
32
import { NaiveCwdDetectionCapability } from 'vs/workbench/contrib/terminal/common/capabilities/naiveCwdDetectionCapability' ;
33
33
import { TerminalCapability } from 'vs/workbench/contrib/terminal/common/capabilities/capabilities' ;
34
+ import { URI } from 'vs/base/common/uri' ;
34
35
35
36
/** The amount of time to consider terminal errors to be related to the launch */
36
37
const LAUNCHING_DURATION = 500 ;
@@ -57,7 +58,7 @@ export class TerminalProcessManager extends Disposable implements ITerminalProce
57
58
processState : ProcessState = ProcessState . Uninitialized ;
58
59
ptyProcessReady : Promise < void > ;
59
60
shellProcessId : number | undefined ;
60
- remoteAuthority : string | undefined ;
61
+ readonly remoteAuthority : string | undefined ;
61
62
os : OperatingSystem | undefined ;
62
63
userHome : string | undefined ;
63
64
isDisconnected : boolean = false ;
@@ -114,6 +115,7 @@ export class TerminalProcessManager extends Disposable implements ITerminalProce
114
115
constructor (
115
116
private readonly _instanceId : number ,
116
117
private readonly _configHelper : ITerminalConfigHelper ,
118
+ cwd : string | URI | undefined ,
117
119
@IHistoryService private readonly _historyService : IHistoryService ,
118
120
@IInstantiationService private readonly _instantiationService : IInstantiationService ,
119
121
@ILogService private readonly _logService : ILogService ,
@@ -146,6 +148,12 @@ export class TerminalProcessManager extends Disposable implements ITerminalProce
146
148
this . _onProcessData . fire ( typeof ev !== 'string' ? ev : { data : beforeProcessDataEvent . data , trackCommit : false } ) ;
147
149
}
148
150
} ) ;
151
+
152
+ if ( cwd && typeof cwd === 'object' ) {
153
+ this . remoteAuthority = getRemoteAuthority ( cwd ) ;
154
+ } else {
155
+ this . remoteAuthority = this . _workbenchEnvironmentService . remoteAuthority ;
156
+ }
149
157
}
150
158
151
159
override dispose ( immediate : boolean = false ) : void {
@@ -194,11 +202,6 @@ export class TerminalProcessManager extends Disposable implements ITerminalProce
194
202
this . _processType = ProcessType . PsuedoTerminal ;
195
203
newProcess = shellLaunchConfig . customPtyImplementation ( this . _instanceId , cols , rows ) ;
196
204
} else {
197
- if ( shellLaunchConfig . cwd && typeof shellLaunchConfig . cwd === 'object' ) {
198
- this . remoteAuthority = getRemoteAuthority ( shellLaunchConfig . cwd ) ;
199
- } else {
200
- this . remoteAuthority = this . _workbenchEnvironmentService . remoteAuthority ;
201
- }
202
205
const backend = this . _terminalInstanceService . getBackend ( this . remoteAuthority ) ;
203
206
if ( ! backend ) {
204
207
throw new Error ( `No terminal backend registered for remote authority '${ this . remoteAuthority } '` ) ;
0 commit comments