diff --git a/browser/api/atom_api_auto_updater.cc b/browser/api/atom_api_auto_updater.cc index 69ed10089128..6375e19a9218 100644 --- a/browser/api/atom_api_auto_updater.cc +++ b/browser/api/atom_api_auto_updater.cc @@ -80,7 +80,9 @@ void AutoUpdater::CheckForUpdates( void AutoUpdater::QuitAndInstall( const v8::FunctionCallbackInfo& args) { AutoUpdater* self = AutoUpdater::Unwrap(args.This()); - self->quit_and_install_.Run(); + + if (!self->quit_and_install_.is_null()) + self->quit_and_install_.Run(); } // static diff --git a/browser/api/lib/auto-updater.coffee b/browser/api/lib/auto-updater.coffee index 81c22f16d57b..4cd8dc9cb7e9 100644 --- a/browser/api/lib/auto-updater.coffee +++ b/browser/api/lib/auto-updater.coffee @@ -8,4 +8,18 @@ autoUpdater.on 'update-downloaded-raw', (args...) -> args[3] = new Date(args[3]) # releaseDate @emit 'update-downloaded', args..., => @quitAndInstall() +autoUpdater.quitAndInstall = -> + # If we don't have any window then quitAndInstall immediately. + BrowserWindow = require 'browser-window' + windows = BrowserWindow.getAllWindows() + if windows.length is 0 + AutoUpdater::quitAndInstall.call this + return + + # Do the restart after all windows have been closed. + app = require 'app' + app.removeAllListeners 'window-all-closed' + app.once 'window-all-closed', AutoUpdater::quitAndInstall.bind(this) + win.close() for win in windows + module.exports = autoUpdater diff --git a/browser/api/lib/ipc.coffee b/browser/api/lib/ipc.coffee index 11377ec28300..c93ed4f20576 100644 --- a/browser/api/lib/ipc.coffee +++ b/browser/api/lib/ipc.coffee @@ -5,6 +5,7 @@ sendWrap = (channel, processId, routingId, args...) -> BrowserWindow = require 'browser-window' if processId?.constructor is BrowserWindow window = processId + args = [routingId, args...] processId = window.getProcessId() routingId = window.getRoutingId() diff --git a/browser/native_window.h b/browser/native_window.h index 0e802fd110d9..0b82b969c723 100644 --- a/browser/native_window.h +++ b/browser/native_window.h @@ -56,7 +56,7 @@ class NativeWindow : public brightray::DefaultWebContentsDelegate, class DialogScope { public: - DialogScope(NativeWindow* window) + explicit DialogScope(NativeWindow* window) : window_(window) { if (window_ != NULL) window_->set_has_dialog_attached(true); diff --git a/script/cibuild b/script/cibuild index d9e8ceb68924..dd2dfc5e99ca 100755 --- a/script/cibuild +++ b/script/cibuild @@ -11,6 +11,8 @@ SOURCE_ROOT = os.path.abspath(os.path.dirname(os.path.dirname(__file__))) def main(): + os.environ['CI'] = '1' + rm_rf(os.path.join(SOURCE_ROOT, 'out')) rm_rf(os.path.join(SOURCE_ROOT, 'node_modules')) rm_rf(os.path.join(SOURCE_ROOT, 'frameworks')) diff --git a/script/lib/util.py b/script/lib/util.py index 8eefed3f9fff..ecbe812162cb 100644 --- a/script/lib/util.py +++ b/script/lib/util.py @@ -36,6 +36,8 @@ def download(text, url, path): downloaded_size = 0 block_size = 128 + ci = os.environ.get('CI') == '1' + while True: buf = web_file.read(block_size) if not buf: @@ -44,11 +46,15 @@ def download(text, url, path): downloaded_size += len(buf) local_file.write(buf) - percent = downloaded_size * 100. / file_size - status = "\r%s %10d [%3.1f%%]" % (text, downloaded_size, percent) - print status, + if not ci: + percent = downloaded_size * 100. / file_size + status = "\r%s %10d [%3.1f%%]" % (text, downloaded_size, percent) + print status, - print + if ci: + print "%s done." % (text) + else: + print def extract_tarball(tarball_path, member, destination):