Use global in repl

This commit is contained in:
Anthony Laibe 2018-07-24 09:40:48 +01:00 committed by Pascal Precht
parent cf0dc06818
commit 30f9166aa8
No known key found for this signature in database
GPG Key ID: 0EE28D8D6FD85D7D
1 changed files with 2 additions and 6 deletions

View File

@ -1,5 +1,4 @@
const repl = require("repl"); const repl = require("repl");
const RunCode = require('../coderunner/runCode');
class REPL { class REPL {
constructor(options) { constructor(options) {
@ -8,9 +7,9 @@ class REPL {
start(done) { start(done) {
this.replServer = repl.start({ this.replServer = repl.start({
prompt: "Embark (" + this.env + ") > " prompt: "Embark (" + this.env + ") > ",
useGlobal: true
}); });
this.initializeContext(this.replServer.context);
this.replServer.on("exit", () => { this.replServer.on("exit", () => {
process.exit(); process.exit();
@ -19,9 +18,6 @@ class REPL {
done(); done();
} }
initializeContext(context) {
context.embark = RunCode.getContext();
}
} }
module.exports = REPL; module.exports = REPL;