killTree

expect fun Process.killTree()

Forcibly kills the process and, where the platform supports it, its whole tree.

Process.destroy only asks politely (SIGTERM / TerminateProcess on the top-level process). On Windows in particular, a browser's renderer and GPU children survive it.

actual fun Process.killTree()
actual fun Process.killTree()

Kills this process and every descendant.

Process.destroyForcibly() on its own only reaches the top-level process; on Windows the browser's renderer and GPU children outlive it and keep holding the profile's files. Descendants are snapshot first, because killing the parent detaches them and they can no longer be enumerated.

actual fun Process.killTree()
actual fun Process.killTree()

Kills this process with SIGKILL.

POSIX has no cheap, portable way to enumerate descendants, so only the process itself is signalled. That is enough here: on Linux and macOS the browser's children terminate with their parent, unlike on Windows.