From 6df2ef5f0c2415f6d74c3ac79653108e45a8c815 Mon Sep 17 00:00:00 2001 From: ChomeNS <95471003+ChomeNS@users.noreply.github.com> Date: Sat, 19 Oct 2024 17:59:11 +0700 Subject: [PATCH] promise ( i don't think does anything?) --- index.js | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/index.js b/index.js index d8787ed..01873a0 100644 --- a/index.js +++ b/index.js @@ -71,13 +71,15 @@ io.on('connection', async (socket) => { resetVM() socket.on('runCode', async (transactionId, code) => { - try { - const output = vm.run(code) + new Promise(() => { + 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)