Clean ssvnc viewer for acloud delete.

Bug: 117474343
Test: m acloud && atest acloud_test && acloud delete
Change-Id: Id59e0c1f1ab723cc0a7640606c433f1790f1dff8
diff --git a/internal/lib/utils.py b/internal/lib/utils.py
index a2b7448..418d14b 100755
--- a/internal/lib/utils.py
+++ b/internal/lib/utils.py
@@ -62,6 +62,7 @@
 ForwardedPorts = collections.namedtuple("ForwardedPorts", [constants.VNC_PORT,
                                                            constants.ADB_PORT])
 _VNC_BIN = "ssvnc"
+_CMD_KILL = ["pkill", "-9", "-f"]
 _CMD_PGREP = "pgrep"
 _CMD_SG = "sg "
 _CMD_START_VNC = "%(bin)s vnc://127.0.0.1:%(port)d"
@@ -1094,3 +1095,14 @@
     except subprocess.CalledProcessError:
         return None
     return os.path.join(android_build_top, dist_dir.strip())
+
+
+def CleanupProcess(pattern):
+    """Cleanup process with pattern.
+
+    Args:
+        pattern: String, string of process pattern.
+    """
+    if IsCommandRunning(pattern):
+        command_kill = _CMD_KILL + [pattern]
+        subprocess.check_call(command_kill)