diff --git a/core/terminal.js b/core/terminal.js index a1d4b9a61..a7159ac22 100644 --- a/core/terminal.js +++ b/core/terminal.js @@ -121,7 +121,13 @@ function invoke(handlers, argv) { var promises = []; if (handlers) { for (var i = 0; i < handlers.length; ++i) { - promises.push(handlers[i].apply({}, argv)); + try { + promises.push(handlers[i].apply({}, argv)); + } catch (error) { + handlers.splice(i, 1); + i--; + promises.push(new Promise(function(resolve, reject) { reject(error); })); + } } } return Promise.all(promises); diff --git a/packages/cory/chat/chat.js b/packages/cory/chat/chat.js index c3d851633..a5521bf36 100644 --- a/packages/cory/chat/chat.js +++ b/packages/cory/chat/chat.js @@ -233,6 +233,11 @@ function updateWindows() { function updateConversation() { if (gCurrentConversation) { + terminal.cork(); + terminal.clear(); + terminal.print("..."); + terminal.uncork(); + Promise.all([ gCurrentConversation.session.getHistory(gCurrentConversation.name), gCurrentConversation.session.getParticipants(gCurrentConversation.name), @@ -405,7 +410,7 @@ function formatMessage(message) { var result; if (typeof message == "string") { for (let i = 0; i < message.length; i++) { - if (message.charCodeAt(i) > 128 && message.charCodeAt(i) < 256) { + if (message.charCodeAt(i) >= 128 /*&& message.charCodeAt(i) < 256*/) { message = message.substring(0, i) + "?" + message.substring(i + 1); } } diff --git a/packages/cory/libchat/libchat.js b/packages/cory/libchat/libchat.js index d8a3c0d0e..df28d1d7b 100644 --- a/packages/cory/libchat/libchat.js +++ b/packages/cory/libchat/libchat.js @@ -48,7 +48,12 @@ exports.ChatService = class { for (let i = self._callbacks.length - 1; i >= 0; i--) { let callback = self._callbacks[i]; try { - callback(message); + callback(message).catch(function(error) { + self._callbacks.splice(i, 1); + + // XXX: Send it to the other connections? + print(error); + }); } catch (error) { self._callbacks.splice(i, 1); diff --git a/tools/update-deps b/tools/update-deps index a8002a9b2..de57aa670 100755 --- a/tools/update-deps +++ b/tools/update-deps @@ -1,6 +1,8 @@ #!/usr/bin/python -u +import multiprocessing import os +import platform import shutil import stat import subprocess @@ -26,6 +28,11 @@ kV8Repository = 'https://github.com/v8/v8.git' kV8Branch = 'branch-heads/5.1' kV8Work = 'v8' +cores = multiprocessing.cpu_count() +if platform.machine() == 'armv7l': + cores = 1 +print 'Using', cores, 'cores.' + def run(*args, **kw): print 'Running:', args, kw subprocess.check_call(*args, **kw) @@ -63,7 +70,7 @@ def updateUv(): if sys.platform == 'linux2': run(['./gyp_uv.py', '-f', 'make'], cwd=kUvWork) - run(['make', '-j8', '-C', 'out'], cwd=kUvWork) + run(['make', '-j' + str(cores), '-C', 'out'], cwd=kUvWork) elif sys.platform == 'darwin': run(['./gyp_uv.py', '-f', 'xcode'], cwd=kUvWork) run(['xcodebuild', '-ARCHS="x86_64"', '-project', 'uv.xcodeproj', '-configuration', 'Release', '-target', 'All'], cwd=kUvWork) @@ -116,7 +123,7 @@ def updateV8(): run(['gclient' + extension, 'sync'], cwd=kV8Work) if sys.platform == 'linux2': - run(['make', '-j4', 'native'], cwd=kV8Work) + run(['make', '-j' + str(cores), 'native'], cwd=kV8Work) elif sys.platform == 'darwin': run(['build/gyp_v8', '-Dtarget_arch=x64'], cwd=kV8Work) run(['xcodebuild', '-project', 'build/all.xcodeproj', '-configuration', 'Release'], cwd=kV8Work)