environment - consistently handle VSCODE_CWD in all our node.js processes

This commit is contained in:
Benjamin Pasero
2021-03-15 11:22:42 +01:00
parent 56ee90e32e
commit 1441ba91f0
15 changed files with 92 additions and 71 deletions

View File

@@ -30,7 +30,7 @@ import type * as vscode from 'vscode';
import { IExtensionDescription } from 'vs/platform/extensions/common/extensions';
import { createDecorator } from 'vs/platform/instantiation/common/instantiation';
import { withNullAsUndefined } from 'vs/base/common/types';
import { IProcessEnvironment } from 'vs/base/common/platform';
import * as process from 'vs/base/common/process';
export const IExtHostDebugService = createDecorator<IExtHostDebugService>('IExtHostDebugService');
@@ -930,7 +930,7 @@ export class ExtHostDebugConsole {
export class ExtHostVariableResolverService extends AbstractVariableResolverService {
constructor(folders: vscode.WorkspaceFolder[], editorService: ExtHostDocumentsAndEditors | undefined, configurationService: ExtHostConfigProvider, env?: IProcessEnvironment, workspaceService?: IExtHostWorkspace) {
constructor(folders: vscode.WorkspaceFolder[], editorService: ExtHostDocumentsAndEditors | undefined, configurationService: ExtHostConfigProvider, workspaceService?: IExtHostWorkspace) {
super({
getFolderUri: (folderName: string): URI | undefined => {
const found = folders.filter(f => f.name === folderName);
@@ -946,10 +946,10 @@ export class ExtHostVariableResolverService extends AbstractVariableResolverServ
return configurationService.getConfiguration(undefined, folderUri).get<string>(section);
},
getAppRoot: (): string | undefined => {
return env ? env['VSCODE_CWD'] : undefined;
return process.cwd();
},
getExecPath: (): string | undefined => {
return env ? env['VSCODE_EXEC_PATH'] : undefined;
return process.env['VSCODE_EXEC_PATH'];
},
getFilePath: (): string | undefined => {
if (editorService) {
@@ -990,7 +990,7 @@ export class ExtHostVariableResolverService extends AbstractVariableResolverServ
}
return undefined;
}
}, undefined, env);
}, undefined, process.env);
}
}