Skip to content

Instantly share code, notes, and snippets.

@jxa
Created February 16, 2011 23:05
Show Gist options
  • Save jxa/830488 to your computer and use it in GitHub Desktop.
Save jxa/830488 to your computer and use it in GitHub Desktop.
can't assign to an existing context property in REPL?
$ node ./test.js
> setContext('sup', 'yo')
> sup
'yo'
> setContext('sup', 'what?')
> sup
'yo'
>
var repl = require('repl'),
session = repl.start(),
context = session.context;
context.setContext = function(key, val){
context[key] = val;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment