From 797cb02b105501914c92aeeddd24410bf97780e7 Mon Sep 17 00:00:00 2001 From: Carlos Date: Tue, 31 Oct 2023 00:41:46 -0300 Subject: [PATCH] Adds an attempt to kill a stuck agent Before launching it. This way we further ensure there will never be two agent's started by the same GUI process. --- gui/packages/ubuntupro/lib/launch_agent.dart | 2 ++ 1 file changed, 2 insertions(+) diff --git a/gui/packages/ubuntupro/lib/launch_agent.dart b/gui/packages/ubuntupro/lib/launch_agent.dart index aa39197f5..cb2d088db 100644 --- a/gui/packages/ubuntupro/lib/launch_agent.dart +++ b/gui/packages/ubuntupro/lib/launch_agent.dart @@ -15,6 +15,8 @@ import 'core/environment.dart'; Future launchAgent(String agentRelativePath) async { final agentPath = p.join(msixRootDir().path, agentRelativePath); try { + // Attempts to kill a possibly stuck agent. Failure is desirable in this case. + await Process.run('taskkill.exe', ['/f', '/im', p.basename(agentPath)]); await Process.start( agentPath, ['-vv'],