rules: uinput: Fix device leakage
While randomly messing around with rule components (I plan to add some new ones), I found this bug by screwing things up (shh...) Signed-off-by: Rongrong <i@rong.moe>
This commit is contained in:
parent
73ced3a7da
commit
8b134c31bb
|
|
@ -16,6 +16,7 @@
|
|||
|
||||
from __future__ import annotations
|
||||
|
||||
import contextlib
|
||||
import ctypes
|
||||
import logging
|
||||
import math
|
||||
|
|
@ -330,6 +331,9 @@ def simulate_uinput(what, code, arg):
|
|||
logger.debug("uinput simulated input %s %s %s", what, code, arg)
|
||||
return True
|
||||
except Exception as e:
|
||||
with contextlib.suppress(Exception):
|
||||
udevice.close()
|
||||
|
||||
udevice = None
|
||||
logger.warning("uinput write failed: %s", e)
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue