mirror of
https://github.com/status-im/embark-area-51.git
synced 2025-02-02 10:25:21 +00:00
fix printing
This commit is contained in:
parent
326e12d23a
commit
c6abafff05
@ -49,12 +49,14 @@ class CodeRunner {
|
|||||||
end--; // Remove the `;` because we add function calls
|
end--; // Remove the `;` because we add function calls
|
||||||
}
|
}
|
||||||
code = code.substring(5, end); // remove await keyword
|
code = code.substring(5, end); // remove await keyword
|
||||||
code += '.then(console.log).catch(console.error);'; // Add promise catch
|
|
||||||
} else {
|
} else {
|
||||||
code = `(async function() {${code}})();`;
|
code = `(async function() {${code}})();`;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
let result = RunCode.doEval(code);
|
let result = RunCode.doEval(code);
|
||||||
|
if (result instanceof Promise) {
|
||||||
|
return result.then((value) => cb(null, value)).catch(cb);
|
||||||
|
}
|
||||||
if (forConsoleOnly && self.ipc.isServer()) {
|
if (forConsoleOnly && self.ipc.isServer()) {
|
||||||
self.commands.push({code});
|
self.commands.push({code});
|
||||||
self.ipc.broadcast("runcode:newCommand", {code});
|
self.ipc.broadcast("runcode:newCommand", {code});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user