6
6
import { exec } from 'child_process' ;
7
7
import { promises as fs } from 'fs' ;
8
8
import type * as pty from 'node-pty' ;
9
- import { tmpdir } from 'os' ;
10
9
import { timeout } from 'vs/base/common/async' ;
11
10
import { Emitter , Event } from 'vs/base/common/event' ;
12
11
import { Disposable } from 'vs/base/common/lifecycle' ;
13
- import { FileAccess } from 'vs/base/common/network' ;
14
12
import * as path from 'vs/base/common/path' ;
15
13
import { IProcessEnvironment , isLinux , isMacintosh , isWindows } from 'vs/base/common/platform' ;
16
14
import { URI } from 'vs/base/common/uri' ;
17
15
import { Promises } from 'vs/base/node/pfs' ;
18
16
import { localize } from 'vs/nls' ;
19
17
import { ILogService } from 'vs/platform/log/common/log' ;
18
+ import { IProductService } from 'vs/platform/product/common/productService' ;
20
19
import { FlowControlConstants , IShellLaunchConfig , ITerminalChildProcess , ITerminalLaunchError , IProcessProperty , IProcessPropertyMap as IProcessPropertyMap , ProcessPropertyType , TerminalShellType , IProcessReadyEvent , ITerminalProcessOptions , PosixShellType } from 'vs/platform/terminal/common/terminal' ;
21
20
import { ChildProcessMonitor } from 'vs/platform/terminal/node/childProcessMonitor' ;
22
21
import { findExecutable , getShellIntegrationInjection , getWindowsBuildNumber , IShellIntegrationConfigInjection } from 'vs/platform/terminal/node/terminalEnvironment' ;
@@ -145,7 +144,8 @@ export class TerminalProcess extends Disposable implements ITerminalChildProcess
145
144
*/
146
145
private readonly _executableEnv : IProcessEnvironment ,
147
146
private readonly _options : ITerminalProcessOptions ,
148
- @ILogService private readonly _logService : ILogService
147
+ @ILogService private readonly _logService : ILogService ,
148
+ @IProductService private readonly _productService : IProductService
149
149
) {
150
150
super ( ) ;
151
151
let name : string ;
@@ -201,7 +201,7 @@ export class TerminalProcess extends Disposable implements ITerminalChildProcess
201
201
202
202
let injection : IShellIntegrationConfigInjection | undefined ;
203
203
if ( this . _options . shellIntegration . enabled ) {
204
- injection = getShellIntegrationInjection ( this . shellLaunchConfig , this . _options . shellIntegration , this . _ptyOptions . env , this . _logService ) ;
204
+ injection = getShellIntegrationInjection ( this . shellLaunchConfig , this . _options . shellIntegration , this . _ptyOptions . env , this . _logService , this . _productService ) ;
205
205
if ( injection ) {
206
206
this . _onDidChangeProperty . fire ( { type : ProcessPropertyType . UsedShellIntegrationInjection , value : true } ) ;
207
207
if ( injection . envMixin ) {
@@ -228,25 +228,6 @@ export class TerminalProcess extends Disposable implements ITerminalChildProcess
228
228
}
229
229
}
230
230
231
- // Handle zsh shell integration - Set $ZDOTDIR to a temp dir and create $ZDOTDIR/.zshrc
232
- if ( this . shellLaunchConfig . env ?. [ '_ZDOTDIR' ] === '1' ) {
233
- const zdotdir = path . join ( tmpdir ( ) , 'vscode-zsh' ) ;
234
- await fs . mkdir ( zdotdir , { recursive : true } ) ;
235
- const source = path . join ( path . dirname ( FileAccess . asFileUri ( '' , require ) . fsPath ) , 'out/vs/workbench/contrib/terminal/browser/media/shellIntegration-rc.zsh' ) ;
236
- // TODO: Does filesToCopy make this unnecessary now?
237
- try {
238
- await fs . copyFile ( source , path . join ( zdotdir , '.zshrc' ) ) ;
239
- } catch {
240
- // Swallow error, this should only happen when multiple users are on the same
241
- // machine. Since the shell integration scripts rarely change, plus the other user
242
- // should be using the same version of the server in this case, assume the script is
243
- // fine if copy fails and swallow the error.
244
- }
245
- this . _ptyOptions . env = this . _ptyOptions . env || { } ;
246
- this . _ptyOptions . env [ 'ZDOTDIR' ] = zdotdir ;
247
- delete this . _ptyOptions . env [ '_ZDOTDIR' ] ;
248
- }
249
-
250
231
try {
251
232
await this . setupPtyProcess ( this . shellLaunchConfig , this . _ptyOptions , injection ) ;
252
233
return undefined ;
0 commit comments