From ce45959a649a5d2afabd13a4934ef055713d166c Mon Sep 17 00:00:00 2001 From: Oj Date: Tue, 1 Feb 2022 21:52:48 +0000 Subject: [PATCH] [CI > Test] Retry on no output --- scripts/testStartup.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/scripts/testStartup.js b/scripts/testStartup.js index 2d17921..cc820e7 100644 --- a/scripts/testStartup.js +++ b/scripts/testStartup.js @@ -1,14 +1,17 @@ const { execFile } = require('child_process'); const test = () => { + console.log('running...'); const proc = execFile('xvfb-run', [process.argv[2], '--enable-logging']); let success = false; + let anyOutput = false; proc.stderr.on('data', (data) => { console.error('stderr', data.toString()); }); proc.stdout.on('data', (data) => { + anyOutput = true; console.log('stdout', data.toString()); if (data.toString().includes('Installing discord_rpc')) { success = true; @@ -17,8 +20,15 @@ const test = () => { }); proc.on('close', async () => { + if (!anyOutput) return; process.exit(success ? 0 : 1); }); + + setTimeout(() => { + if (anyOutput) return; + console.log('detected no output in 5s, retrying...'); + proc.kill(); + }, 5000); }; -test(); \ No newline at end of file +while (true) test(); \ No newline at end of file