promise ( i don't think does anything?)

This commit is contained in:
Chayapak 2024-10-19 17:59:11 +07:00
parent 403a9613b6
commit 6df2ef5f0c

View file

@ -71,13 +71,15 @@ io.on('connection', async (socket) => {
resetVM() resetVM()
socket.on('runCode', async (transactionId, code) => { socket.on('runCode', async (transactionId, code) => {
try { new Promise(() => {
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)