diff --git a/CHANGELOG.md b/CHANGELOG.md
index 850f872..8a6e2ea 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -80,6 +80,7 @@ For major (breaking) changes - **version 4, 3 and 2** - see end of page.
| Version | Date | Comment |
| -------------- | -------------- | -------- |
+| 5.9.6 | 2021-10-08 | `system()` fixed virtual on WSL2 |
| 5.9.5 | 2021-10-08 | `battery()` fixed isCharging (windows) |
| 5.9.4 | 2021-09-23 | `processes()` fixed memVsz, Memrss (macOS M1) |
| 5.9.3 | 2021-09-17 | `cpuTemperature()` improved tdie detection (linus) |
diff --git a/docs/history.html b/docs/history.html
index 5d7241e..6d5c509 100644
--- a/docs/history.html
+++ b/docs/history.html
@@ -57,10 +57,15 @@
+
+ | 5.9.6 |
+ 2021-10-08 |
+ system() fixed virtual on WSL2 |
+
| 5.9.5 |
2021-10-08 |
- battery() fix isCharging (windows) |
+ battery() fixed isCharging (windows) |
| 5.9.4 |
diff --git a/docs/index.html b/docs/index.html
index ef913e8..4ffe545 100644
--- a/docs/index.html
+++ b/docs/index.html
@@ -170,7 +170,7 @@
systeminformation
- New Version: 5.9.5
+ New Version: 5.9.6
diff --git a/lib/system.js b/lib/system.js
index a510450..daa6b4c 100644
--- a/lib/system.js
+++ b/lib/system.js
@@ -122,10 +122,10 @@ function system(callback) {
util.noop();
}
}
- if (!result.virtual && util.linuxVersion().toLowerCase().indexOf('microsoft') >= 0) {
+ if (!result.virtual && (util.linuxVersion().toLowerCase().indexOf('microsoft') >= 0 || os.release().toLowerCase().indexOf('microsoft') >= 0 || os.release().toLowerCase().endsWith('wsl2'))) {
let versionStr = util.linuxVersion().toLowerCase();
versionStr = versionStr.split('-')[0].replace('#', '');
- const version = parseInt(versionStr, 10) || null;
+ const version = os.release().toLowerCase().endsWith('wsl2') ? 'WSL2' : parseInt(versionStr, 10) || null;
result.virtual = true;
result.manufacturer = 'Microsoft';
result.model = 'WSL';