Skip to content

Instantly share code, notes, and snippets.

@aaronj1335
Created August 10, 2012 20:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aaronj1335/3317494 to your computer and use it in GitHub Desktop.
Save aaronj1335/3317494 to your computer and use it in GitHub Desktop.
node.js repl
#!/usr/bin/env node
var repl = require('repl'),
fs = require('fs'),
path = require('path'),
vm = require('vm');
var myrepl = repl.start('> ');
var stup = path.join(process.env.HOME, '.noderc');
vm.runInContext(fs.readFileSync(stup).toString(), myrepl.context);
process.argv.slice(2).forEach(function(filename) {
vm.runInContext(fs.readFileSync(filename).toString(), myrepl.context);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment