Skip to content

Instantly share code, notes, and snippets.

@isaacs
Created March 8, 2011 19:36
Show Gist options
  • Select an option

  • Save isaacs/860864 to your computer and use it in GitHub Desktop.

Select an option

Save isaacs/860864 to your computer and use it in GitHub Desktop.
var vm = require("vm")
, fs = require("fs")
try {
vm.runInNewContext(fs.readFileSync(process.argv[2], "utf8"))
} catch (ex) {
if (ex.constructor.name === "SyntaxError") throw ex
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment