Don't touch global fs object in graceful-fs
This commit is contained in:
parent
3f8ad3bf75
commit
0c0a6bd939
1 changed files with 10 additions and 1 deletions
|
@ -43,4 +43,13 @@ asar.wrapFsWithAsar fs
|
||||||
# Make graceful-fs work with asar.
|
# Make graceful-fs work with asar.
|
||||||
source = process.binding 'natives'
|
source = process.binding 'natives'
|
||||||
source.originalFs = source.fs
|
source.originalFs = source.fs
|
||||||
source.fs = "module.exports = require('fs');"
|
source.fs = """
|
||||||
|
var src = '(function (exports, require, module, __filename, __dirname) { ' +
|
||||||
|
process.binding('natives').originalFs +
|
||||||
|
' });';
|
||||||
|
var vm = require('vm');
|
||||||
|
var fn = vm.runInThisContext(src, { filename: 'fs.js' });
|
||||||
|
fn(exports, require, module);
|
||||||
|
var asar = require('#{__dirname}/asar');
|
||||||
|
asar.wrapFsWithAsar(exports);
|
||||||
|
"""
|
||||||
|
|
Loading…
Reference in a new issue