Extract getBlhostCmd() to shared.js
This commit is contained in:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user