0933a7d1b2
Some high-level APIs in fs are using low-level APIs via "fs.xxx", which will be overriden by our asar wrappers, so just shadow-copy those methods is not enough. By evaluating the whole "fs.js" we can make sure original-fs is not polluted by the asar wrappers. Fixes #782.
8 lines
288 B
CoffeeScript
8 lines
288 B
CoffeeScript
vm = require 'vm'
|
|
|
|
# Execute the 'fs.js' and pass the 'exports' to it.
|
|
source = '(function (exports, require, module, __filename, __dirname) { ' +
|
|
process.binding('natives').fs +
|
|
'\n});'
|
|
fn = vm.runInThisContext source, { filename: 'fs.js' }
|
|
fn exports, require, module
|