3 # © Copyright 2021-2022, Scott Gasch
5 """Miscellaneous utilities."""
11 def is_running_as_root() -> bool:
14 True if running as root, False otherwise.
16 >>> is_running_as_root()
19 return os.geteuid() == 0
22 def debugger_is_attached() -> bool:
25 True if a debugger is attached, False otherwise.
27 gettrace = getattr(sys, 'gettrace', lambda: None)
28 return gettrace() is not None
31 if __name__ == '__main__':