Skip to content

Instantly share code, notes, and snippets.

@robinduckett
Created July 28, 2010 14:59
Show Gist options
  • Select an option

  • Save robinduckett/494797 to your computer and use it in GitHub Desktop.

Select an option

Save robinduckett/494797 to your computer and use it in GitHub Desktop.
var sys = require('sys');
var EventEmitter = require('events').EventEmitter;
var Script = process.binding('evals').Script;
function EventScript(code, filename) {
this.code = code;
this.filename = filename;
};
sys.inherits(EventScript, EventEmitter);
EventScript.prototype.runInNewContext = function (sandbox) {
sandbox.events = this;
this.script = new Script(this.code, this.filename);
this.script.runInNewContext(sandbox);
delete sandbox.events;
};
exports.EventScript = EventScript;
@robinduckett
Copy link
Copy Markdown
Author

Any idea why this makes node segfault?

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