Skip to content

Commit

Permalink
fix: disable app sandbox when --no-sandbox is present (#184913)
Browse files Browse the repository at this point in the history
* fix: disable app sandbox when --no-sandbox is present (#184897)

* fix: loading minimist in packaged builds
  • Loading branch information
deepak1556 authored Jun 13, 2023
1 parent d98b2db commit 4f95907
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,17 +27,19 @@ const { getUNCHost, addUNCHostToAllowlist } = require('./vs/base/node/unc');
const product = require('../product.json');
const { app, protocol, crashReporter, Menu } = require('electron');

// Enable sandbox globally
app.enableSandbox();

// Enable portable support
const portable = bootstrapNode.configurePortable(product);

// Enable ASAR support
bootstrap.enableASARSupport();

// Set userData path before app 'ready' event
// Enable sandbox globally unless disabled via `--no-sandbox` argument
const args = parseCLIArgs();
if (args['sandbox']) {
app.enableSandbox();
}

// Set userData path before app 'ready' event
const userDataPath = getUserDataPath(args, product.nameShort ?? 'code-oss-dev');
if (process.platform === 'win32') {
const userDataUNCHost = getUNCHost(userDataPath);
Expand Down Expand Up @@ -464,7 +466,13 @@ function parseCLIArgs() {
'locale',
'js-flags',
'crash-reporter-directory'
]
],
default: {
'sandbox': true
},
alias: {
'no-sandbox': 'sandbox'
}
});
}

Expand Down

0 comments on commit 4f95907

Please sign in to comment.