Fix how we filter out atom-shell switches in process.argv.

This commit is contained in:
Cheng Zhao 2014-01-31 16:40:20 +08:00
parent 0df59e2714
commit 2634328720
3 changed files with 10 additions and 6 deletions

View file

@ -58,6 +58,9 @@ void AtomMainDelegate::PreSandboxStartup() {
if (process_type == switches::kRendererProcess) if (process_type == switches::kRendererProcess)
return; return;
// Add a flag to mark the start of switches added by atom-shell.
command_line->AppendSwitch("atom-shell-switches-start");
// Disable renderer sandbox for most of node's functions. // Disable renderer sandbox for most of node's functions.
command_line->AppendSwitch(switches::kNoSandbox); command_line->AppendSwitch(switches::kNoSandbox);
@ -66,7 +69,7 @@ void AtomMainDelegate::PreSandboxStartup() {
command_line->AppendSwitch(switches::kDisableAcceleratedCompositing); command_line->AppendSwitch(switches::kDisableAcceleratedCompositing);
// Add a flag to mark the end of switches added by atom-shell. // Add a flag to mark the end of switches added by atom-shell.
command_line->AppendSwitch("no-more-atom-shell-switches"); command_line->AppendSwitch("atom-shell-switches-end");
} }
void AtomMainDelegate::InitializeResourceBundle() { void AtomMainDelegate::InitializeResourceBundle() {

View file

@ -8,11 +8,7 @@ app.on('window-all-closed', function() {
app.quit(); app.quit();
}); });
// Pick out switches appended by atom-shell. var argv = optimist(process.argv.slice(1)).boolean('ci').argv;
var endMark = process.argv.indexOf('--no-more-atom-shell-switches');
process.execArgv = process.argv.splice(1, endMark)
var argv = optimist(process.argv.slice(1)).argv;
// Start the specified app if there is one specified in command line, otherwise // Start the specified app if there is one specified in command line, otherwise
// start the default app. // start the default app.

View file

@ -9,6 +9,11 @@ process.resourcesPath = path.resolve process.argv[1], '..', '..', '..'
# we need to restore it here. # we need to restore it here.
process.argv.splice 1, 1 process.argv.splice 1, 1
# Pick out switches appended by atom-shell.
startMark = process.argv.indexOf '--atom-shell-switches-start'
endMark = process.argv.indexOf '--atom-shell-switches-end'
process.execArgv = process.argv.splice startMark, endMark - startMark + 1
# Add browser/api/lib to require's search paths, # Add browser/api/lib to require's search paths,
# which contains javascript part of Atom's built-in libraries. # which contains javascript part of Atom's built-in libraries.
globalPaths = require('module').globalPaths globalPaths = require('module').globalPaths