summaryrefslogtreecommitdiff
path: root/tools/edit_monitor/main.py
diff options
context:
space:
mode:
author Zhuoyao Zhang <zhuoyao@google.com> 2024-12-05 23:16:43 +0000
committer Zhuoyao Zhang <zhuoyao@google.com> 2024-12-06 18:15:38 +0000
commit130da8edf5e3767653c0f51455441692f561c88a (patch)
tree3460b2a6dc9ed9e777232415d70fe5c98f0c016b /tools/edit_monitor/main.py
parentafdc92c6457db8b3383df783c8ad631d20ceb455 (diff)
Update the logic to force cleanup all edit monitor instances.
Instead of checking the pidfiles, query all the running process with binary ends with "edit_monitor" and kill all of those processes. This ensures that if there are any unexpected edit monitor instances running (e.g. due to b/382135550), the force cleanup can kill those processes as well. Bug: 382135550 Test: atest daemon_manager_test Change-Id: I299f16b7b913e4ee470b5fe9ef0ffdad8d3c0945
Diffstat (limited to 'tools/edit_monitor/main.py')
-rw-r--r--tools/edit_monitor/main.py10
1 files changed, 5 insertions, 5 deletions
diff --git a/tools/edit_monitor/main.py b/tools/edit_monitor/main.py
index 7ca0daa7c5..3c2d183aed 100644
--- a/tools/edit_monitor/main.py
+++ b/tools/edit_monitor/main.py
@@ -102,12 +102,12 @@ def main(argv: list[str]):
daemon_args=(args.path, args.dry_run),
)
- if args.force_cleanup:
- dm.cleanup()
-
try:
- dm.start()
- dm.monitor_daemon()
+ if args.force_cleanup:
+ dm.cleanup()
+ else:
+ dm.start()
+ dm.monitor_daemon()
except Exception:
logging.exception('Unexpected exception raised when run daemon.')
finally: