From 7809278b356775374a0c42a11c0aba7603f2d1f0 Mon Sep 17 00:00:00 2001 From: Sebastian Hildebrandt Date: Tue, 24 Dec 2024 13:27:20 +0100 Subject: [PATCH] osInfo() fix fqdn --- CHANGELOG.md | 1 + docs/history.html | 7 ++++++- docs/index.html | 2 +- lib/osinfo.js | 13 +++---------- 4 files changed, 11 insertions(+), 12 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 18ad8c3e..b2220dd0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -90,6 +90,7 @@ For major (breaking) changes - **version 4, 3 and 2** - see end of page. | Version | Date | Comment | | ------- | ---------- | --------------------------------------------------------------------------------------------------- | +| 5.23.21 | 2024-12-24 | `osInfo()` fix fqdn | | 5.23.20 | 2024-12-24 | `cpu()` fix timeout | | 5.23.19 | 2024-12-24 | `cpu()` refactored using internal node functions | | 5.23.18 | 2024-12-24 | `cpu()` Handle RISC-V CPU Manufacturer and Brand | diff --git a/docs/history.html b/docs/history.html index 402db4e1..aa3fb198 100644 --- a/docs/history.html +++ b/docs/history.html @@ -58,7 +58,12 @@

Full version history

- 5.23.19 + 5.23.21 + 2024-12-24 + osInfo() fix fqdn (linux) + + + 5.23.20 2024-12-24 inetChecksite() fix timeout diff --git a/docs/index.html b/docs/index.html index a84b89ec..db8ade0e 100644 --- a/docs/index.html +++ b/docs/index.html @@ -170,7 +170,7 @@
systeminformation
 
-
New Version: 5.23.20
+
New Version: 5.23.21
diff --git a/lib/osinfo.js b/lib/osinfo.js index cf645172..bac305c5 100644 --- a/lib/osinfo.js +++ b/lib/osinfo.js @@ -190,17 +190,10 @@ function getFQDN() { let fqdn = os.hostname; if (_linux || _darwin) { try { - const stdout = execSync('hostnamectl --json short 2>/dev/null', util.execOptsLinux); - const json = JSON.parse(stdout.toString()); - - fqdn = json['StaticHostname']; + const stdout = execSync('hostname -f 2>/dev/null', util.execOptsLinux); + fqdn = stdout.toString().split(os.EOL)[0]; } catch (e) { - try { - const stdout = execSync('hostname -f 2>/dev/null', util.execOptsLinux); - fqdn = stdout.toString().split(os.EOL)[0]; - } catch (e) { - util.noop(); - } + util.noop(); } } if (_freebsd || _openbsd || _netbsd) {