mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
e7f6f079cb
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
33 lines
693 B
JavaScript
Executable File
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);
|