No need for try/catch any longer.

The old behavior of SysCommand was that exit codes raised an exception, which needed to be handled by each individual caller. We now utilize `.exit_code` instead to manually detect faulty commands and raise exceptions where needed.
This commit is contained in:
Anton Hvornum 2021-09-06 13:22:53 +00:00 committed by GitHub
parent bbce3aa26a
commit 5fe752cf72
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 0 additions and 11 deletions

View File

@ -149,16 +149,5 @@ def virtualization() -> Optional[str]:
def is_vm() -> bool:
return b"none" not in b"".join(SysCommand("systemd-detect-virt")).lower()
"""
try:
# systemd-detect-virt issues a non-zero exit code if it is not on a virtual machine
if b"none" not in b"".join(SysCommand("systemd-detect-virt")).lower():
return True
except:
pass
return False
"""
# TODO: Add more identifiers