Skip to content

Instantly share code, notes, and snippets.

@davidascher
Created March 18, 2011 05:33
Show Gist options
  • Save davidascher/875659 to your computer and use it in GitHub Desktop.
Save davidascher/875659 to your computer and use it in GitHub Desktop.
test case for irc q about runInThisContext
var x = 'test';
var vm = require('vm');
console.log('in test.js');
var test = "console.log('in test.vm'); console.log('x = ', x);";
vm.runInThisContext(test, 'test.vm');
@davidascher
Copy link
Author

This throws an exception because x isn't available in "this" context.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment