feat: code runner use fs overrided

This commit is contained in:
Anthony Laibe 2018-12-17 10:47:38 +00:00
parent a147e2706b
commit 944b392cc5
1 changed files with 4 additions and 1 deletions

View File

@ -1,10 +1,13 @@
const vm = require('vm');
const fs = require('../../fs');
class RunCode {
constructor({logger}) {
this.logger = logger;
const newGlobal = Object.create(global);
newGlobal.fs = fs;
this.context = Object.assign({}, {
global, console, exports, require, module, __filename, __dirname, process,
global: newGlobal, console, exports, require, module, __filename, __dirname, process,
setTimeout, setInterval, clearTimeout, clearInterval
});
}