Merge pull request 'fix hwid error handling' (#21) from dev into master
Reviewed-on: #21
This commit is contained in:
commit
f31126e2b1
|
@ -25,12 +25,16 @@ const defaultHWID = "recorderinthesandybridge";
|
|||
*/
|
||||
function getHwId() {
|
||||
return new Promise((resolve) => {
|
||||
const getter = platforms[process.platform];
|
||||
if (getter) {
|
||||
const result = getter[1].exec(child_process.execSync(getter[0], options));
|
||||
if (result) resolve(crypto.createHash("md5").update(result[1]).digest("hex"));
|
||||
try {
|
||||
const getter = platforms[process.platform];
|
||||
if (getter) {
|
||||
const result = getter[1].exec(child_process.execSync(getter[0], options));
|
||||
if (result) resolve(crypto.createHash("md5").update(result[1]).digest("hex"));
|
||||
}
|
||||
resolve(crypto.createHash("md5").update(defaultHWID).digest("hex"));
|
||||
} catch {
|
||||
resolve(crypto.createHash("md5").update(defaultHWID).digest("hex"));
|
||||
}
|
||||
resolve(crypto.createHash("md5").update(defaultHWID).digest("hex"));
|
||||
})
|
||||
}
|
||||
exports.getHwId = getHwId;
|
||||
|
|
Loading…
Reference in New Issue
Block a user