Created
July 28, 2010 14:59
-
-
Save robinduckett/494797 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Any idea why this makes node segfault?