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:
parent
bbce3aa26a
commit
5fe752cf72
|
|
@ -149,16 +149,5 @@ def virtualization() -> Optional[str]:
|
||||||
|
|
||||||
def is_vm() -> bool:
|
def is_vm() -> bool:
|
||||||
return b"none" not in b"".join(SysCommand("systemd-detect-virt")).lower()
|
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
|
# TODO: Add more identifiers
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue