From 2634328720bf018d4643ee6d4a3aea7ecca62ca2 Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Fri, 31 Jan 2014 16:40:20 +0800 Subject: [PATCH] Fix how we filter out atom-shell switches in process.argv. --- app/atom_main_delegate.cc | 5 ++++- browser/default_app/main.js | 6 +----- browser/lib/init.coffee | 5 +++++ 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/app/atom_main_delegate.cc b/app/atom_main_delegate.cc index 816df2916b13..d8f0c693d494 100644 --- a/app/atom_main_delegate.cc +++ b/app/atom_main_delegate.cc @@ -58,6 +58,9 @@ void AtomMainDelegate::PreSandboxStartup() { if (process_type == switches::kRendererProcess) 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. command_line->AppendSwitch(switches::kNoSandbox); @@ -66,7 +69,7 @@ void AtomMainDelegate::PreSandboxStartup() { command_line->AppendSwitch(switches::kDisableAcceleratedCompositing); // 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() { diff --git a/browser/default_app/main.js b/browser/default_app/main.js index acf1a38976df..b3e3bcb03640 100644 --- a/browser/default_app/main.js +++ b/browser/default_app/main.js @@ -8,11 +8,7 @@ app.on('window-all-closed', function() { app.quit(); }); -// Pick out switches appended by atom-shell. -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; +var argv = optimist(process.argv.slice(1)).boolean('ci').argv; // Start the specified app if there is one specified in command line, otherwise // start the default app. diff --git a/browser/lib/init.coffee b/browser/lib/init.coffee index 950d4671ac56..1b22b3d259b3 100644 --- a/browser/lib/init.coffee +++ b/browser/lib/init.coffee @@ -9,6 +9,11 @@ process.resourcesPath = path.resolve process.argv[1], '..', '..', '..' # we need to restore it here. 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, # which contains javascript part of Atom's built-in libraries. globalPaths = require('module').globalPaths