Applied hack from https://github.com/joyent/node/blob/v0.10.16-release/lib/repl.js#L62