Files
react-native/scripts/circleci/run_with_retry.js
T
Riccardo Cipolleschi e7f6f079cb Implement retry mechanism during yarn installation (#39020)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/39020

Sometimes yarn fails to intall, we are implementing a retry mechanism

## Changelog:
[Internal] - Add retry mechanism in template jobs.

Reviewed By: cortinico

Differential Revision: D48234860

fbshipit-source-id: ece3c40051ff143837ed79db2390fbb599fa8ae2
2023-08-16 08:31:44 -07:00

33 lines
693 B
JavaScript
Executable File

/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @format
*/
const {retry} = require('./retry');
async function retryCommand(maxRetries, command) {
const success = await retry(
command,
{shell: true, stdio: 'inherit'},
maxRetries,
0,
);
if (!success) {
process.exit(1);
}
}
const maxRetries = process.argv[2];
const command = process.argv.slice(3).join(' ');
if (!maxRetries || !command) {
console.log('Usage: node retry_script.js <max_retries> <command>');
process.exit(1);
}
retryCommand(maxRetries, command);