Skip to content

Commit

Permalink
osInfo() improved fqdn (linux)
Browse files Browse the repository at this point in the history
  • Loading branch information
sebhildebrandt committed Jun 3, 2023
1 parent bab409f commit 216eda3
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 7 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Expand Up @@ -82,6 +82,7 @@ For major (breaking) changes - **version 4, 3 and 2** - see end of page.

| Version | Date | Comment |
| ------- | ---------- | --------------------------------------------------------------------------------------------------- |
| 5.17.17 | 2023-06-03 | `osInfo()` improved fqdn (linux) |
| 5.17.16 | 2023-05-30 | `usb()` fix parsing JSON (mac OS) |
| 5.17.15 | 2023-05-29 | `powershell()` added NoProfile to speed up powershell (windows) |
| 5.17.14 | 2023-05-29 | `diskLayout()`, `osInfo()` fix parsing issues (mac OS) |
Expand Down
5 changes: 5 additions & 0 deletions docs/history.html
Expand Up @@ -57,6 +57,11 @@ <h3>Full version history</h3>
</tr>
</thead>
<tbody>
<tr>
<th scope="row">5.17.17</th>
<td>2023-06-03</td>
<td><span class="code">osInfo()</span> improved fqdn (linux)</td>
</tr>
<tr>
<th scope="row">5.17.16</th>
<td>2023-05-30</td>
Expand Down
2 changes: 1 addition & 1 deletion docs/index.html
Expand Up @@ -170,7 +170,7 @@
<img class="logo" src="assets/logo.png" alt="logo">
<div class="title">systeminformation</div>
<div class="subtitle"><span id="typed"></span>&nbsp;</div>
<div class="version">New Version: <span id="version">5.17.13</span></div>
<div class="version">New Version: <span id="version">5.17.17</span></div>
<button class="btn btn-light" onclick="location.href='https://github.com/sebhildebrandt/systeminformation'">View on Github <i class=" fab fa-github"></i></button>
</div>
<div class="down">
Expand Down
18 changes: 12 additions & 6 deletions lib/osinfo.js
Expand Up @@ -168,15 +168,21 @@ function getFQDN() {
let fqdn = os.hostname;
if (_linux || _darwin) {
try {
const stdout = execSync('hostname -f');
fqdn = stdout.toString().split(os.EOL)[0];
const stdout = execSync('hostnamectl --json short 2>/dev/null');
const json = JSON.parse(stdout.toString());

fqdn = json['StaticHostname'];
} catch (e) {
util.noop();
try {
const stdout = execSync('hostname -f 2>/dev/null');
fqdn = stdout.toString().split(os.EOL)[0];
} catch (e) {
util.noop();
}
}
}
if (_freebsd || _openbsd || _netbsd) {
} if (_freebsd || _openbsd || _netbsd) {
try {
const stdout = execSync('hostname');
const stdout = execSync('hostname 2>/dev/null');
fqdn = stdout.toString().split(os.EOL)[0];
} catch (e) {
util.noop();
Expand Down

0 comments on commit 216eda3

Please sign in to comment.