25 lines
497 B
JavaScript
25 lines
497 B
JavaScript
require('shelljs/global');
|
|
|
|
function execRetry(command) {
|
|
let firstRun = true;
|
|
let remainingRetries = 3;
|
|
let code;
|
|
do {
|
|
if (!firstRun) {
|
|
console.log(`Retrying ${command}`)
|
|
}
|
|
config.fatal = !remainingRetries;
|
|
code = exec(command).code;
|
|
config.fatal = true;
|
|
firstRun = false;
|
|
} while(code && --remainingRetries);
|
|
}
|
|
|
|
const exp = {
|
|
execRetry
|
|
}
|
|
|
|
Object.keys(exp).forEach(function (cmd) {
|
|
global[cmd] = exp[cmd];
|
|
});
|