mirror of
https://github.com/bellard/quickjs.git
synced 2025-09-30 06:54:26 +03:00
fixed Promise return in the REPL by using a wrapper object in async std.evalScript() (github issue #231)
This commit is contained in:
3
repl.js
3
repl.js
@@ -1310,7 +1310,7 @@ import * as os from "os";
|
||||
/* result is a promise */
|
||||
result.then(print_eval_result, print_eval_error);
|
||||
} else {
|
||||
print_eval_result(result);
|
||||
print_eval_result({ value: result });
|
||||
}
|
||||
} catch (error) {
|
||||
print_eval_error(error);
|
||||
@@ -1318,6 +1318,7 @@ import * as os from "os";
|
||||
}
|
||||
|
||||
function print_eval_result(result) {
|
||||
result = result.value;
|
||||
eval_time = os.now() - eval_start_time;
|
||||
std.puts(colors[styles.result]);
|
||||
print(result);
|
||||
|
Reference in New Issue
Block a user