summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDave Olszewski <cxreg@pobox.com>2013-01-18 16:25:52 -0800
committerisaacs <i@izs.me>2013-03-03 15:28:45 -0800
commit22aa76742166967a8ed23426dbf78c182d1378e4 (patch)
tree187242ee9a7679cb7121e673a9e22843e464145c /lib
parent80ea63b95810e60fcdeaf3db67fec60c27b49832 (diff)
downloadandroid-node-v8-22aa76742166967a8ed23426dbf78c182d1378e4.tar.gz
android-node-v8-22aa76742166967a8ed23426dbf78c182d1378e4.tar.bz2
android-node-v8-22aa76742166967a8ed23426dbf78c182d1378e4.zip
make repl compatible with domains
The try/catch in repl.js keeps any active domain from catching the error. Since the domain may not even be enterd until the code is run, it's not possible to avoid the try/catch, so emit on the domain when an error is thrown.
Diffstat (limited to 'lib')
-rw-r--r--lib/repl.js8
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/repl.js b/lib/repl.js
index e19a92e49e..f0c1cb270f 100644
--- a/lib/repl.js
+++ b/lib/repl.js
@@ -114,7 +114,13 @@ function REPLServer(prompt, stream, eval_, useGlobal, ignoreUndefined) {
} catch (e) {
err = e;
}
- cb(err, result);
+ if (err && process.domain) {
+ process.domain.emit('error', err);
+ process.domain.exit();
+ }
+ else {
+ cb(err, result);
+ }
};
if (!input && !output) {