aboutsummaryrefslogtreecommitdiff
path: root/lib/internal
diff options
context:
space:
mode:
authorGus Caplan <me@gus.host>2018-02-23 00:19:50 -0600
committerGus Caplan <me@gus.host>2018-03-01 09:18:30 -0600
commitabd0d79304c97911a343f945dde35113012ed291 (patch)
treed6709e3bf143c2389a98d6a97bc2b9a7978b533b /lib/internal
parent3828fc6289783a632b00270d6b72b5c5bdd6437d (diff)
downloadandroid-node-v8-abd0d79304c97911a343f945dde35113012ed291.tar.gz
android-node-v8-abd0d79304c97911a343f945dde35113012ed291.tar.bz2
android-node-v8-abd0d79304c97911a343f945dde35113012ed291.zip
loader: fix --inspect-brk
PR-URL: https://github.com/nodejs/node/pull/18949 Fixes: https://github.com/nodejs/node/issues/18948 Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com> Reviewed-By: Guy Bedford <guybedford@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Eugene Ostroukhov <eostroukhov@google.com> Reviewed-By: James M Snell <jasnell@gmail.com>
Diffstat (limited to 'lib/internal')
-rw-r--r--lib/internal/loader/ModuleJob.js12
1 files changed, 7 insertions, 5 deletions
diff --git a/lib/internal/loader/ModuleJob.js b/lib/internal/loader/ModuleJob.js
index db37765b20..f79cc6cfe1 100644
--- a/lib/internal/loader/ModuleJob.js
+++ b/lib/internal/loader/ModuleJob.js
@@ -15,6 +15,7 @@ class ModuleJob {
this.loader = loader;
this.error = null;
this.hadError = false;
+ this.inspectBrk = inspectBrk;
// This is a Promise<{ module, reflect }>, whose fields will be copied
// onto `this` by `link()` below once it has been resolved.
@@ -26,10 +27,6 @@ class ModuleJob {
const link = async () => {
({ module: this.module,
reflect: this.reflect } = await this.modulePromise);
- if (inspectBrk) {
- const initWrapper = process.binding('inspector').callAndPauseOnStart;
- initWrapper(this.module.instantiate, this.module);
- }
assert(this.module instanceof ModuleWrap);
const dependencyJobs = [];
@@ -83,7 +80,12 @@ class ModuleJob {
throw e;
}
try {
- this.module.instantiate();
+ if (this.inspectBrk) {
+ const initWrapper = process.binding('inspector').callAndPauseOnStart;
+ initWrapper(this.module.instantiate, this.module);
+ } else {
+ this.module.instantiate();
+ }
} catch (e) {
decorateErrorStack(e);
throw e;