[CI > Test] Retry on no output
This commit is contained in:
parent
6f0b17cb6d
commit
ce45959a64
1 changed files with 11 additions and 1 deletions
|
@ -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();
|
||||
while (true) test();
|
Loading…
Reference in a new issue