mirror of
https://github.com/bellard/quickjs.git
synced 2025-05-12 11:06:10 +08:00
disable rejection tracker in the repl - repl cleanup
This commit is contained in:
parent
e8cfe8fede
commit
d045a13b4b
1
qjs.c
1
qjs.c
@ -465,6 +465,7 @@ int main(int argc, char **argv)
|
||||
goto fail;
|
||||
}
|
||||
if (interactive) {
|
||||
JS_SetHostPromiseRejectionTracker(rt, NULL, NULL);
|
||||
js_std_eval_binary(ctx, qjsc_repl, qjsc_repl_size, 0);
|
||||
}
|
||||
js_std_loop(ctx);
|
||||
|
14
repl.js
14
repl.js
@ -1098,24 +1098,20 @@ import * as os from "os";
|
||||
}
|
||||
mexpr = "";
|
||||
|
||||
eval_and_print_start(expr, true);
|
||||
eval_and_print_start(expr);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
function eval_and_print_start(expr, is_async) {
|
||||
function eval_and_print_start(expr) {
|
||||
var result;
|
||||
|
||||
try {
|
||||
eval_start_time = os.now();
|
||||
/* eval as a script */
|
||||
result = std.evalScript(expr, { backtrace_barrier: true, async: is_async });
|
||||
if (is_async) {
|
||||
/* result is a promise */
|
||||
result.then(print_eval_result, print_eval_error);
|
||||
} else {
|
||||
print_eval_result({ value: result });
|
||||
}
|
||||
result = std.evalScript(expr, { backtrace_barrier: true, async: true });
|
||||
/* result is a promise */
|
||||
result.then(print_eval_result, print_eval_error);
|
||||
} catch (error) {
|
||||
print_eval_error(error);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user