From a2457edc6fa689fdde099c1722d8cf9551d87c1d Mon Sep 17 00:00:00 2001 From: Vrganj Date: Fri, 15 Jan 2021 22:13:29 +0100 Subject: [PATCH] Trim output --- api/src/index.js | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/api/src/index.js b/api/src/index.js index fcbe547..a7c769f 100644 --- a/api/src/index.js +++ b/api/src/index.js @@ -95,13 +95,11 @@ async function launch(res, language, body) { result.output += chunk; }); - result.stderr = result.stderr.substring(0, 65535); - result.stdout = result.stdout.substring(0, 65535); - result.output = result.output.substring(0, 65535); + result.stderr = result.stderr.trim().substring(0, 65535); + result.stdout = result.stdout.trim().substring(0, 65535); + result.output = result.output.trim().substring(0, 65535); - process.on('exit', () => { - res.json(result); - }); + process.on('exit', () => res.json(result)); } app.get('/versions', (req, res) => {