diff options
author | Anna Henningsen <anna@addaleax.net> | 2019-01-28 16:52:23 +0100 |
---|---|---|
committer | Anna Henningsen <anna@addaleax.net> | 2019-01-30 18:17:06 +0100 |
commit | 94ebf3f0a733902477674d6cc945ad052755bb28 (patch) | |
tree | b3a756e88f1b3d17231aa1ef4c1e539c1320ef2e /lib/internal | |
parent | 8919169bb718a53a0c4496dcf2cd9674f8a79b0b (diff) | |
download | android-node-v8-94ebf3f0a733902477674d6cc945ad052755bb28.tar.gz android-node-v8-94ebf3f0a733902477674d6cc945ad052755bb28.tar.bz2 android-node-v8-94ebf3f0a733902477674d6cc945ad052755bb28.zip |
module: silence ModuleJob unhandled rejection warnings
This could otherwise print unhandled rejection warnings
if the process does not exit immediately inside an earlier
`.catch()` handler.
PR-URL: https://github.com/nodejs/node/pull/25769
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Gus Caplan <me@gus.host>
Reviewed-By: Michaƫl Zasso <targos@protonmail.com>
Reviewed-By: Guy Bedford <guybedford@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Diffstat (limited to 'lib/internal')
-rw-r--r-- | lib/internal/modules/esm/module_job.js | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/internal/modules/esm/module_job.js b/lib/internal/modules/esm/module_job.js index fbb29aef78..e3fb91ca6f 100644 --- a/lib/internal/modules/esm/module_job.js +++ b/lib/internal/modules/esm/module_job.js @@ -6,6 +6,8 @@ const { decorateErrorStack } = require('internal/util'); const assert = require('assert'); const resolvedPromise = SafePromise.resolve(); +function noop() {} + /* A ModuleJob tracks the loading of a single Module, and the ModuleJobs of * its dependencies, over time. */ class ModuleJob { @@ -41,6 +43,9 @@ class ModuleJob { }; // Promise for the list of all dependencyJobs. this.linked = link(); + // This promise is awaited later anyway, so silence + // 'unhandled rejection' warnings. + this.linked.catch(noop); // instantiated == deep dependency jobs wrappers instantiated, // module wrapper instantiated |