i
This commit is contained in:
parent
651076d6bd
commit
342e21a229
1 changed files with 8 additions and 6 deletions
14
index.js
14
index.js
|
@ -68,13 +68,15 @@ io.on('connection', (socket) => {
|
||||||
resetVM()
|
resetVM()
|
||||||
|
|
||||||
socket.on('runCode', (transactionId, code) => {
|
socket.on('runCode', (transactionId, code) => {
|
||||||
try {
|
(async () => {
|
||||||
const output = vm.run(code)
|
try {
|
||||||
|
const output = vm.run(code)
|
||||||
|
|
||||||
socket.emit('codeOutput', transactionId, false, util.inspect(output, { stylize }))
|
socket.emit('codeOutput', transactionId, false, util.inspect(output, { stylize }))
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
socket.emit('codeOutput', transactionId, true, e.toString())
|
socket.emit('codeOutput', transactionId, true, e.toString())
|
||||||
}
|
}
|
||||||
|
})()
|
||||||
})
|
})
|
||||||
|
|
||||||
socket.on('reset', resetVM)
|
socket.on('reset', resetVM)
|
||||||
|
|
Loading…
Reference in a new issue