Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes #80702 #80705

Merged
merged 1 commit into from
Sep 11, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion build/gulpfile.vscode.linux.js
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ function prepareSnapPackage(arch) {
.pipe(replace('@@NAME_LONG@@', product.nameLong))
.pipe(replace('@@NAME_SHORT@@', product.nameShort))
.pipe(replace('@@NAME@@', product.applicationName))
.pipe(replace('@@EXEC@@', product.applicationName))
.pipe(replace('@@EXEC@@', `${product.applicationName} --force-user-env`))
.pipe(replace('@@ICON@@', `\${SNAP}/meta/gui/${product.linuxIconName}.png`))
.pipe(replace('@@URLPROTOCOL@@', product.urlProtocol));

Expand Down
4 changes: 2 additions & 2 deletions resources/linux/snap/snapcraft.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,14 @@ parts:

apps:
@@NAME@@:
command: electron-launch $SNAP/usr/share/@@NAME@@/@@NAME@@
command: electron-launch $SNAP/usr/share/@@NAME@@/bin/@@NAME@@
common-id: @@NAME@@.desktop
environment:
DISABLE_WAYLAND: 1
GSETTINGS_SCHEMA_DIR: $SNAP/usr/share/glib-2.0/schemas

url-handler:
command: electron-launch $SNAP/usr/share/@@NAME@@/@@NAME@@ --open-url
command: electron-launch $SNAP/usr/share/@@NAME@@/bin/@@NAME@@ --open-url
environment:
DISABLE_WAYLAND: 1
GSETTINGS_SCHEMA_DIR: $SNAP/usr/share/glib-2.0/schemas
10 changes: 7 additions & 3 deletions src/vs/code/node/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
*--------------------------------------------------------------------------------------------*/

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

// Just Code
else {
const env = assign({}, process.env, {
const env: NodeJS.ProcessEnv = {
...process.env,
'VSCODE_CLI': '1', // this will signal Code that it was spawned from this module
'ELECTRON_NO_ATTACH_CONSOLE': '1'
});
};

if (args['force-user-env']) {
env['VSCODE_FORCE_USER_ENV'] = '1';
}

delete env['ELECTRON_RUN_AS_NODE'];

Expand Down
2 changes: 1 addition & 1 deletion src/vs/code/node/shellEnv.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ export function getShellEnvironment(logService: ILogService, environmentService:
} else if (isWindows) {
logService.trace('getShellEnvironment: running on Windows, skipping');
_shellEnv = Promise.resolve({});
} else if (process.env['VSCODE_CLI'] === '1') {
} else if (process.env['VSCODE_CLI'] === '1' && process.env['VSCODE_FORCE_USER_ENV'] !== '1') {
logService.trace('getShellEnvironment: running on CLI, skipping');
_shellEnv = Promise.resolve({});
} else {
Expand Down
1 change: 1 addition & 0 deletions src/vs/platform/environment/common/environment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ export interface ParsedArgs {
'disable-user-env-probe'?: boolean;
'disable-inspect'?: boolean;
'force'?: boolean;
'force-user-env'?: boolean;

// node flags
'js-flags'?: string;
Expand Down
1 change: 1 addition & 0 deletions src/vs/platform/environment/node/argv.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ export const OPTIONS: OptionDescriptions<Required<ParsedArgs>> = {
'trace-category-filter': { type: 'string' },
'trace-options': { type: 'string' },
'disable-inspect': { type: 'boolean' },
'force-user-env': { type: 'boolean' },

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