From 42982019386ff0e29bd44af480c3f40e82b04d07 Mon Sep 17 00:00:00 2001 From: "Alex Lam S.L" Date: Fri, 16 Oct 2020 14:56:54 +0100 Subject: [PATCH] flush `stdout` from `ufuzz` jobs properly (#4224) --- test/ufuzz/index.js | 1 + test/ufuzz/job.js | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/test/ufuzz/index.js b/test/ufuzz/index.js index e650a46f..09cad3b2 100644 --- a/test/ufuzz/index.js +++ b/test/ufuzz/index.js @@ -331,6 +331,7 @@ function strictMode() { function createTopLevelCode() { VAR_NAMES.length = INITIAL_NAMES_LEN; // prune any previous names still in the list + block_vars.length = 0; unique_vars.length = 0; loops = 0; funcs = 0; diff --git a/test/ufuzz/job.js b/test/ufuzz/job.js index 20f6ee0e..52c057e8 100644 --- a/test/ufuzz/job.js +++ b/test/ufuzz/job.js @@ -48,8 +48,10 @@ function run() { stderr = ""; child.stderr.on("data", trap).pipe(process.stdout); log = setInterval(function() { + stdout = stdout.replace(/[^\r\n]+\r(?=[^\r\n]+\r)/g, ""); var end = stdout.lastIndexOf("\r"); - console.log(stdout.slice(stdout.lastIndexOf("\r", end - 1) + 1, end)); + if (end < 0) return; + console.log(stdout.slice(0, end)); stdout = stdout.slice(end + 1); }, 5 * 60 * 1000); } -- 2.34.1