dbus_manager: verify stat path exists
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
This commit is contained in:
parent
e0cf635d34
commit
0188b81d4a
|
@ -16,11 +16,13 @@ from typing import (
|
||||||
TYPE_CHECKING,
|
TYPE_CHECKING,
|
||||||
List,
|
List,
|
||||||
Optional,
|
Optional,
|
||||||
|
Any,
|
||||||
)
|
)
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from confighelper import ConfigHelper
|
from confighelper import ConfigHelper
|
||||||
|
|
||||||
|
STAT_PATH = "/proc/self/stat"
|
||||||
DOC_URL = (
|
DOC_URL = (
|
||||||
"https://moonraker.readthedocs.io/en/latest/"
|
"https://moonraker.readthedocs.io/en/latest/"
|
||||||
"installation/#policykit-permissions"
|
"installation/#policykit-permissions"
|
||||||
|
@ -34,7 +36,11 @@ class DbusManager:
|
||||||
self.bus: Optional[MessageBus] = None
|
self.bus: Optional[MessageBus] = None
|
||||||
self.polkit: Optional[ProxyInterface] = None
|
self.polkit: Optional[ProxyInterface] = None
|
||||||
self.warned: bool = False
|
self.warned: bool = False
|
||||||
proc_data = pathlib.Path(f"/proc/self/stat").read_text()
|
st_path = pathlib.Path(STAT_PATH)
|
||||||
|
self.polkit_subject: List[Any] = []
|
||||||
|
if not st_path.is_file():
|
||||||
|
return
|
||||||
|
proc_data = st_path.read_text()
|
||||||
start_clk_ticks = int(proc_data.split()[21])
|
start_clk_ticks = int(proc_data.split()[21])
|
||||||
self.polkit_subject = [
|
self.polkit_subject = [
|
||||||
"unix-process",
|
"unix-process",
|
||||||
|
|
Loading…
Reference in New Issue