From 647bc3a7c735a02ecd97d2b849340dc022dcee61 Mon Sep 17 00:00:00 2001 From: Ahmed Wael Date: Fri, 26 Jan 2024 08:41:28 +0200 Subject: [PATCH] handle stdout and stderr limits properly (#643) * handle stdout and stderr limits proberly Co-authored-by: Omar Brikaa * added environment to docker compose --------- Co-authored-by: Omar Brikaa --- api/src/job.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/api/src/job.js b/api/src/job.js index 46efe27f..a2641f93 100644 --- a/api/src/job.js +++ b/api/src/job.js @@ -221,7 +221,7 @@ class Job { proc.stderr.on('data', async data => { if (event_bus !== null) { event_bus.emit('stderr', data); - } else if (stderr.length > this.runtime.output_max_size) { + } else if ((stderr.length + data.length) > this.runtime.output_max_size) { this.logger.info(`stderr length exceeded`); try { process.kill(proc.pid, 'SIGKILL'); @@ -242,7 +242,7 @@ class Job { proc.stdout.on('data', async data => { if (event_bus !== null) { event_bus.emit('stdout', data); - } else if (stdout.length > this.runtime.output_max_size) { + } else if ((stdout.length + data.length) > this.runtime.output_max_size) { this.logger.info(`stdout length exceeded`); try { process.kill(proc.pid, 'SIGKILL');