Skip to content
This repository was archived by the owner on Feb 1, 2022. It is now read-only.

Commit 3ac6232

Browse files
author
Jan Krems
committed
feat: Add version command
1 parent 8a070c4 commit 3ac6232

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

lib/node-inspect.js

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -470,7 +470,7 @@ function createAgentProxy(domain, inspector) {
470470
}
471471

472472
function createCommandContext(inspector) {
473-
const { Debugger, repl, stdout } = inspector;
473+
const { Debugger, Runtime, repl, stdout } = inspector;
474474

475475
let currentSourceLocation = undefined;
476476
let currentFrame = undefined;
@@ -597,6 +597,16 @@ function createCommandContext(inspector) {
597597
return ctx.listScripts();
598598
},
599599

600+
get version() {
601+
return Runtime.evaluate({
602+
expression: 'process.versions.v8',
603+
contextId: 1,
604+
returnByValue: true,
605+
}).then(({ result }) => {
606+
print(result.value);
607+
});
608+
},
609+
600610
debugEval(code) {
601611
// Repl asked for scope variables
602612
if (code === '.scope') {
@@ -912,6 +922,10 @@ function createCommandContext(inspector) {
912922
}
913923
});
914924

925+
Runtime.on('executionContextCreated', execContext => {
926+
console.log('execContext', execContext);
927+
});
928+
915929
return ctx;
916930
}
917931

0 commit comments

Comments
 (0)