-
Notifications
You must be signed in to change notification settings - Fork 29.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Broken example for vm.runInDebugContext(code) #4862
Comments
/cc @nodejs/documentation |
Oh, that's because you need to start the debugger first now before you have access to |
Like this:
|
@bnoordhuis can you share an example of running arbitrary in a vm context? I think I can get a test for #4819 by running some code in a debug context, but perhaps I am missing some... context (sorry couldn't help it). When I try something like
I get undefined:1
var util = require("util");
^
ReferenceError: require is not defined
at <anonymous>:1:12 As the definition of runInDebugContext is I'll dig into the c++ and report back |
That's correct. It's a clean slate JS VM with debugger bits but no node bits. It's similar to |
@bnoordhuis ahhh. That makes a lot of sense. I'll dig into the debugger source and see how it sets up the environment. That is a bit out of scope for this issue though, so I'll try and put together a working example for VM and perhaps some documentation about the context |
Did you figure out how to do it? |
The debugger needs to be active now before one is allowed to query the list of scripts. Replace the example with one that works without installing a debug event listener first. Fixes: nodejs#4862 PR-URL: nodejs#6757 Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Myles Borins <[email protected]>
The debugger needs to be active now before one is allowed to query the list of scripts. Replace the example with one that works without installing a debug event listener first. Fixes: #4862 PR-URL: #6757 Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Myles Borins <[email protected]>
The debugger needs to be active now before one is allowed to query the list of scripts. Replace the example with one that works without installing a debug event listener first. Fixes: #4862 PR-URL: #6757 Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Myles Borins <[email protected]>
The debugger needs to be active now before one is allowed to query the list of scripts. Replace the example with one that works without installing a debug event listener first. Fixes: #4862 PR-URL: #6757 Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Myles Borins <[email protected]>
The current example fails
The error I receive is
Debug.scripts().forEach(function(script) { ^ illegal access
Will do more research and post in this thread
The text was updated successfully, but these errors were encountered: