Skip to content
Create a gist now

Instantly share code, notes, and snippets.

@herby /code.js

Embed URL


Subversion checkout URL

You can clone with
Download ZIP
runInThisContext fails to run within the context of the caller; it instead runs in root context
var vm = process.binding('evals').Script;
var ctx = vm.createContext({vm:vm}); = 1;
console.log(' ',;
console.log('this ', vm.runInThisContext(""));
console.log('new ', vm.runInNewContext(
';', {vm:vm}));
console.log('new this ',vm.runInNewContext(
'; vm.runInThisContext("")', {vm:vm}));
vm.runInContext(' = 2', ctx);
console.log('ctx ', vm.runInContext(
'', ctx));
console.log('ctx this ', vm.runInContext(
'vm.runInThisContext("")', ctx)); 1
this 1
new 2
new this 1
ctx 2
ctx this 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.