systeminformation 5.17.16 → 5.17.17

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/lib/osinfo.js +12 -6
  2. package/package.json +1 -1
package/lib/osinfo.js CHANGED
@@ -168,15 +168,21 @@ function getFQDN() {
168
168
  let fqdn = os.hostname;
169
169
  if (_linux || _darwin) {
170
170
  try {
171
- const stdout = execSync('hostname -f');
172
- fqdn = stdout.toString().split(os.EOL)[0];
171
+ const stdout = execSync('hostnamectl --json short 2>/dev/null');
172
+ const json = JSON.parse(stdout.toString());
173
+
174
+ fqdn = json['StaticHostname'];
173
175
  } catch (e) {
174
- util.noop();
176
+ try {
177
+ const stdout = execSync('hostname -f 2>/dev/null');
178
+ fqdn = stdout.toString().split(os.EOL)[0];
179
+ } catch (e) {
180
+ util.noop();
181
+ }
175
182
  }
176
- }
177
- if (_freebsd || _openbsd || _netbsd) {
183
+ } if (_freebsd || _openbsd || _netbsd) {
178
184
  try {
179
- const stdout = execSync('hostname');
185
+ const stdout = execSync('hostname 2>/dev/null');
180
186
  fqdn = stdout.toString().split(os.EOL)[0];
181
187
  } catch (e) {
182
188
  util.noop();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "systeminformation",
3
- "version": "5.17.16",
3
+ "version": "5.17.17",
4
4
  "description": "Advanced, lightweight system and OS information library",
5
5
  "license": "MIT",
6
6
  "author": "Sebastian Hildebrandt <hildebrandt@plus-innovations.com> (https://plus-innovations.com)",