summaryrefslogtreecommitdiff
path: root/cli/worker.rs
diff options
context:
space:
mode:
authorBartek IwaƄczuk <biwanczuk@gmail.com>2020-10-06 10:18:22 +0200
committerGitHub <noreply@github.com>2020-10-06 10:18:22 +0200
commitc7c767782538243ded64742dca9b34d6af74d62d (patch)
treee0c4cdaac58f56b09c54476d73f3d5feb419e731 /cli/worker.rs
parent40324ff74816a99ea061929ece1c6a4ff3078bc3 (diff)
fix(core): module execution with top level await (#7672)
This commit fixes implementation of top level await in "deno_core". Previously promise returned from module execution was ignored causing to execute modules out-of-order. With this commit promise returned from module execution is stored on "JsRuntime" and event loop is polled until the promise resolves.
Diffstat (limited to 'cli/worker.rs')
-rw-r--r--cli/worker.rs4
1 files changed, 2 insertions, 2 deletions
diff --git a/cli/worker.rs b/cli/worker.rs
index 08ccd418e..47e5c4761 100644
--- a/cli/worker.rs
+++ b/cli/worker.rs
@@ -189,7 +189,7 @@ impl Worker {
) -> Result<(), AnyError> {
let id = self.preload_module(module_specifier).await?;
self.wait_for_inspector_session();
- self.isolate.mod_evaluate(id)
+ self.isolate.mod_evaluate(id).await
}
/// Loads, instantiates and executes provided source code
@@ -204,7 +204,7 @@ impl Worker {
.load_module(module_specifier, Some(code))
.await?;
self.wait_for_inspector_session();
- self.isolate.mod_evaluate(id)
+ self.isolate.mod_evaluate(id).await
}
/// Returns a way to communicate with the Worker from other threads.