Extract getBlhostCmd() to shared.js

This commit is contained in:
László Monda
2017-10-29 17:35:55 +01:00
parent 976e402445
commit f847cc844e
2 changed files with 28 additions and 26 deletions

View File

@@ -1,5 +1,26 @@
require('shelljs/global');
function getBlhostCmd() {
let blhostPath;
switch (process.platform) {
case 'linux':
blhostPath = 'linux/amd64/blhost';
break;
case 'darwin':
blhostPath = 'mac/blhost';
break;
case 'win32':
blhostPath = 'win/blhost.exe';
break;
default:
echo('Your operating system is not supported');
exit(1);
break;
}
return `../../../lib/bootloader/bin/Tools/blhost/${blhostPath} --usb 0x1d50,0x6121`;
}
function execRetry(command) {
let firstRun = true;
let remainingRetries = 3;
@@ -16,7 +37,8 @@ function execRetry(command) {
}
const exp = {
execRetry
getBlhostCmd,
execRetry,
}
Object.keys(exp).forEach(function (cmd) {