From 5bde87efabd3eb7fdd9d92fb8111e18f198e54e5 Mon Sep 17 00:00:00 2001 From: Sebastian Hildebrandt Date: Tue, 27 Jul 2021 12:22:45 +0200 Subject: [PATCH] osInfo() fix uefi detection (win) --- CHANGELOG.md | 1 + docs/history.html | 5 +++++ docs/index.html | 2 +- lib/osinfo.js | 39 +++++++++++++++++++-------------------- 4 files changed, 26 insertions(+), 21 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 07f4f97..98c2df6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -77,6 +77,7 @@ For major (breaking) changes - **version 4, 3 and 2** - see end of page. | Version | Date | Comment | | -------------- | -------------- | -------- | +| 5.7.12 | 2021-07-27 | `osInfo()` fix uefi detection (win) | | 5.7.11 | 2021-07-27 | typescript typings fix `bluetoothDevices()` | | 5.7.10 | 2021-07-26 | typescript typings fix `processLoad()` | | 5.7.9 | 2021-07-25 | `uuid()` better regedit path detection (win) | diff --git a/docs/history.html b/docs/history.html index 1a955cf..bef06fa 100644 --- a/docs/history.html +++ b/docs/history.html @@ -56,6 +56,11 @@ + + 5.7.12 + 2021-07-27 + osInfo() fix uefi detection (win) + 5.7.11 2021-07-27 diff --git a/docs/index.html b/docs/index.html index 4971a68..a8e7d8d 100644 --- a/docs/index.html +++ b/docs/index.html @@ -170,7 +170,7 @@
systeminformation
 
-
New Version: 5.7.11
+
New Version: 5.7.12
diff --git a/lib/osinfo.js b/lib/osinfo.js index 6d34630..685ef9b 100644 --- a/lib/osinfo.js +++ b/lib/osinfo.js @@ -365,14 +365,14 @@ function isUefiLinux() { process.nextTick(() => { fs.stat('/sys/firmware/efi', function (err) { if (!err) { - resolve(true); + return resolve(true); } else { exec('dmesg | grep -E "EFI v"', function (error, stdout) { if (!error) { const lines = stdout.toString().split('\n'); - resolve(lines.length > 0); + return resolve(lines.length > 0); } - resolve(false); + return resolve(false); }); } }); @@ -387,21 +387,20 @@ function isUefiWindows() { exec('findstr /C:"Detected boot environment" "%windir%\\Panther\\setupact.log"', util.execOptsWin, function (error, stdout) { if (!error) { const line = stdout.toString().split('\n\r')[0]; - resolve(line.toLowerCase().indexOf('efi') >= 0); - return; + return resolve(line.toLowerCase().indexOf('efi') >= 0); } else { exec('echo %firmware_type%', util.execOptsWin, function (error, stdout) { if (!error) { const line = stdout.toString() || ''; - resolve(line.toLowerCase().indexOf('efi') >= 0); + return resolve(line.toLowerCase().indexOf('efi') >= 0); } - resolve(false); + return resolve(false); }); } - resolve(false); + return resolve(false); }); } catch (e) { - resolve(false); + return resolve(false); } }); }); @@ -1015,18 +1014,18 @@ function shell(callback) { process.nextTick(() => { if (_windows) { resolve('cmd'); + } else { + let result = ''; + exec('echo $SHELL', function (error, stdout) { + if (!error) { + result = stdout.toString().split('\n')[0]; + } + if (callback) { + callback(result); + } + resolve(result); + }); } - - let result = ''; - exec('echo $SHELL', function (error, stdout) { - if (!error) { - result = stdout.toString().split('\n')[0]; - } - if (callback) { - callback(result); - } - resolve(result); - }); }); }); }