From 342e21a229e2bfe8d0094fd86594d1073300e166 Mon Sep 17 00:00:00 2001 From: ChomeNS <95471003+ChomeNS@users.noreply.github.com> Date: Fri, 18 Aug 2023 07:09:44 +0700 Subject: [PATCH] i --- index.js | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/index.js b/index.js index 806727f..76b28fe 100644 --- a/index.js +++ b/index.js @@ -68,13 +68,15 @@ io.on('connection', (socket) => { resetVM() socket.on('runCode', (transactionId, code) => { - try { - const output = vm.run(code) + (async () => { + try { + const output = vm.run(code) - socket.emit('codeOutput', transactionId, false, util.inspect(output, { stylize })) - } catch (e) { - socket.emit('codeOutput', transactionId, true, e.toString()) - } + socket.emit('codeOutput', transactionId, false, util.inspect(output, { stylize })) + } catch (e) { + socket.emit('codeOutput', transactionId, true, e.toString()) + } + })() }) socket.on('reset', resetVM)