diff --git a/cmd/tools/vdoctor.v b/cmd/tools/vdoctor.v index 1db57b393a..fec3e80efe 100644 --- a/cmd/tools/vdoctor.v +++ b/cmd/tools/vdoctor.v @@ -50,18 +50,26 @@ fn (mut a App) collect_info() { } // mut os_details := '' + wsl_check := a.cmd({ + command: 'cat /proc/sys/kernel/osrelease' + }) if os_kind == 'linux' { os_details = a.get_linux_os_name() info := a.cpu_info() if 'hypervisor' in info['flags'] { - if 'microsoft' in a.cmd({ - command: 'cat /proc/sys/kernel/osrelease' - }) { - os_details += ' (WSL)' + if 'microsoft' in wsl_check { + // WSL 2 is a Managed VM and Full Linux Kernel + // See https://docs.microsoft.com/en-us/windows/wsl/compare-versions + os_details += ' (WSL 2)' } else { os_details += ' (VM)' } } + // WSL 1 is NOT a Managed VM and Full Linux Kernel + // See https://docs.microsoft.com/en-us/windows/wsl/compare-versions + if 'Microsoft' in wsl_check { + os_details += ' (WSL)' + } // From https://unix.stackexchange.com/a/14346 if a.cmd(command: '[ "$(awk \'\$5=="/" {print \$1}\'