#14 Workaround error by retrying 3 times when the command fail.

This commit is contained in:
Quentin Decaunes 2019-06-01 16:17:48 +02:00
parent 2654786160
commit 1f5c439def

View File

@ -29,6 +29,7 @@ ready(function(){
*/
function applyRyzenSettings() {
const settings = getCurrentSettings("ryzenadjArgs");
const appSettings = require('electron-settings');
const child = require('child_process').execFile;
const executablePath = getRyzenAdjExecutablePath();
@ -65,9 +66,20 @@ function applyRyzenSettings() {
}
}
if (!appSettings.get('retry')) {
appSettings.set('retry', 2);
notification('warning', 'Applying settings...');
} else {
let retry = appSettings.get('retry') - 1;
appSettings.set('retry', retry);
}
child(executablePath, parameters, function(err, data) {
var output = data.toString();
if (err) {
let retry = appSettings.get('retry');
if (retry) {
return applyRyzenSettings();
}
notification('danger', err + '<br/>' + output);
}
else if (output) {