Compliment to #461 and #459: is_vm() also outputted 'kvm'. This should fix that.

This commit is contained in:
Anton Hvornum 2021-05-18 00:28:59 +02:00
parent ba939188cf
commit d0bc166e7e
No known key found for this signature in database
GPG Key ID: F1234C5BA67C59DF
1 changed files with 6 additions and 3 deletions

View File

@ -109,9 +109,12 @@ def cpu_vendor() -> Optional[str]:
def is_vm() -> bool:
try:
subprocess.check_call(["systemd-detect-virt"]) # systemd-detect-virt issues a non-zero exit code if it is not on a virtual machine
return True
# systemd-detect-virt issues a non-zero exit code if it is not on a virtual machine
if b"".join(SysCommand("systemd-detect-virt")).lower() != b"none":
return True
except:
return False
pass
return False
# TODO: Add more identifiers