Skip to content

Commit b9f4ab0

Browse files
authored
linux - restore --no-sandbox for startup scripts (microsoft#126028)
1 parent ca66517 commit b9f4ab0

File tree

3 files changed

+8
-4
lines changed

3 files changed

+8
-4
lines changed

resources/linux/code-url-handler.desktop

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
Name=@@NAME_LONG@@ - URL Handler
33
Comment=Code Editing. Redefined.
44
GenericName=Text Editor
5-
Exec=@@EXEC@@ --open-url %U
5+
Exec=@@EXEC@@ --no-sandbox --open-url %U
66
Icon=@@ICON@@
77
Type=Application
88
NoDisplay=true

resources/linux/code.desktop

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
Name=@@NAME_LONG@@
33
Comment=Code Editing. Redefined.
44
GenericName=Text Editor
5-
Exec=@@EXEC@@ --unity-launch %F
5+
Exec=@@EXEC@@ --no-sandbox --unity-launch %F
66
Icon=@@ICON@@
77
Type=Application
88
StartupNotify=false
@@ -14,5 +14,5 @@ Keywords=vscode;
1414

1515
[Desktop Action new-empty-window]
1616
Name=New Empty Window
17-
Exec=@@EXEC@@ --new-window %F
17+
Exec=@@EXEC@@ --no-sandbox --new-window %F
1818
Icon=@@ICON@@

src/vs/code/node/cli.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import { isAbsolute, join } from 'vs/base/common/path';
1515
import { whenDeleted, writeFileSync } from 'vs/base/node/pfs';
1616
import { findFreePort } from 'vs/base/node/ports';
1717
import { randomPort } from 'vs/base/common/ports';
18-
import { isWindows, IProcessEnvironment } from 'vs/base/common/platform';
18+
import { isLinux, isWindows, IProcessEnvironment } from 'vs/base/common/platform';
1919
import type { ProfilingSession, Target } from 'v8-inspect-profiler';
2020
import { isString } from 'vs/base/common/types';
2121
import { hasStdinWithoutTty, stdinDataListener, getStdinFilePath, readFromStdin } from 'vs/platform/environment/node/stdin';
@@ -319,6 +319,10 @@ export async function main(argv: string[]): Promise<any> {
319319
options['stdio'] = 'ignore';
320320
}
321321

322+
if (isLinux) {
323+
addArg(argv, '--no-sandbox'); // Electron 6 introduces a chrome-sandbox that requires root to run. This can fail. Disable sandbox via --no-sandbox
324+
}
325+
322326
const child = spawn(process.execPath, argv.slice(2), options);
323327

324328
if (args.wait && waitMarkerFilePath) {

0 commit comments

Comments
 (0)