Skip to content

Commit ab10e26

Browse files
authored
1 parent d4f1c39 commit ab10e26

6 files changed

Lines changed: 13 additions & 7 deletions

File tree

build/gulpfile.vscode.linux.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ function prepareSnapPackage(arch) {
217217
.pipe(replace('@@NAME_LONG@@', product.nameLong))
218218
.pipe(replace('@@NAME_SHORT@@', product.nameShort))
219219
.pipe(replace('@@NAME@@', product.applicationName))
220-
.pipe(replace('@@EXEC@@', product.applicationName))
220+
.pipe(replace('@@EXEC@@', `${product.applicationName} --force-user-env`))
221221
.pipe(replace('@@ICON@@', `\${SNAP}/meta/gui/${product.linuxIconName}.png`))
222222
.pipe(replace('@@URLPROTOCOL@@', product.urlProtocol));
223223

resources/linux/snap/snapcraft.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,14 +49,14 @@ parts:
4949

5050
apps:
5151
@@NAME@@:
52-
command: electron-launch $SNAP/usr/share/@@NAME@@/@@NAME@@
52+
command: electron-launch $SNAP/usr/share/@@NAME@@/bin/@@NAME@@
5353
common-id: @@NAME@@.desktop
5454
environment:
5555
DISABLE_WAYLAND: 1
5656
GSETTINGS_SCHEMA_DIR: $SNAP/usr/share/glib-2.0/schemas
5757

5858
url-handler:
59-
command: electron-launch $SNAP/usr/share/@@NAME@@/@@NAME@@ --open-url
59+
command: electron-launch $SNAP/usr/share/@@NAME@@/bin/@@NAME@@ --open-url
6060
environment:
6161
DISABLE_WAYLAND: 1
6262
GSETTINGS_SCHEMA_DIR: $SNAP/usr/share/glib-2.0/schemas

src/vs/code/node/cli.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
*--------------------------------------------------------------------------------------------*/
55

66
import { spawn, ChildProcess, SpawnOptions } from 'child_process';
7-
import { assign } from 'vs/base/common/objects';
87
import { buildHelpMessage, buildVersionMessage, addArg, createWaitMarkerFile, OPTIONS } from 'vs/platform/environment/node/argv';
98
import { parseCLIProcessArgv } from 'vs/platform/environment/node/argvHelper';
109
import { ParsedArgs } from 'vs/platform/environment/common/environment';
@@ -118,10 +117,15 @@ export async function main(argv: string[]): Promise<any> {
118117

119118
// Just Code
120119
else {
121-
const env = assign({}, process.env, {
120+
const env: NodeJS.ProcessEnv = {
121+
...process.env,
122122
'VSCODE_CLI': '1', // this will signal Code that it was spawned from this module
123123
'ELECTRON_NO_ATTACH_CONSOLE': '1'
124-
});
124+
};
125+
126+
if (args['force-user-env']) {
127+
env['VSCODE_FORCE_USER_ENV'] = '1';
128+
}
125129

126130
delete env['ELECTRON_RUN_AS_NODE'];
127131

src/vs/code/node/shellEnv.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ export function getShellEnvironment(logService: ILogService, environmentService:
9898
} else if (isWindows) {
9999
logService.trace('getShellEnvironment: running on Windows, skipping');
100100
_shellEnv = Promise.resolve({});
101-
} else if (process.env['VSCODE_CLI'] === '1') {
101+
} else if (process.env['VSCODE_CLI'] === '1' && process.env['VSCODE_FORCE_USER_ENV'] !== '1') {
102102
logService.trace('getShellEnvironment: running on CLI, skipping');
103103
_shellEnv = Promise.resolve({});
104104
} else {

src/vs/platform/environment/common/environment.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ export interface ParsedArgs {
7373
'disable-user-env-probe'?: boolean;
7474
'disable-inspect'?: boolean;
7575
'force'?: boolean;
76+
'force-user-env'?: boolean;
7677

7778
// node flags
7879
'js-flags'?: string;

src/vs/platform/environment/node/argv.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ export const OPTIONS: OptionDescriptions<Required<ParsedArgs>> = {
110110
'trace-category-filter': { type: 'string' },
111111
'trace-options': { type: 'string' },
112112
'disable-inspect': { type: 'boolean' },
113+
'force-user-env': { type: 'boolean' },
113114

114115
'js-flags': { type: 'string' }, // chrome js flags
115116
'nolazy': { type: 'boolean' }, // node inspect

0 commit comments

Comments
 (0)