Skip to content

Commit 94ebf3f

Browse files
committed
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: #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>
1 parent 8919169 commit 94ebf3f

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

lib/internal/modules/esm/module_job.js

+5
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ const { decorateErrorStack } = require('internal/util');
66
const assert = require('assert');
77
const resolvedPromise = SafePromise.resolve();
88

9+
function noop() {}
10+
911
/* A ModuleJob tracks the loading of a single Module, and the ModuleJobs of
1012
* its dependencies, over time. */
1113
class ModuleJob {
@@ -41,6 +43,9 @@ class ModuleJob {
4143
};
4244
// Promise for the list of all dependencyJobs.
4345
this.linked = link();
46+
// This promise is awaited later anyway, so silence
47+
// 'unhandled rejection' warnings.
48+
this.linked.catch(noop);
4449

4550
// instantiated == deep dependency jobs wrappers instantiated,
4651
// module wrapper instantiated

0 commit comments

Comments
 (0)