Maybe this works for killing on Windows

This commit is contained in:
Mikko Ahlroth 2018-03-12 21:48:24 +02:00
parent d1e341e37c
commit 8249d5c32b

View file

@ -38,7 +38,7 @@ defmodule MBU.AppRunner do
end
def kill(pid) do
System.find_executable("kill") |> System.cmd([pid])
os_kill(pid, :os.type())
end
def wait_loop(port) do
@ -83,7 +83,7 @@ defmodule MBU.AppRunner do
# screen and also redirects stdout properly. Without this flag, stdout
# is not passed back to BEAM and cannot be logged.
:hide,
args: real_args,
line: 1024
]
@ -101,6 +101,14 @@ defmodule MBU.AppRunner do
]
)
end
defp os_kill(pid, {:win32, _}) do
System.find_executable("cmd") |> System.cmd(["/c", "taskkill", "/PID", pid, "/F"])
end
defp os_kill(pid, _) do
System.find_executable("kill") |> System.cmd([pid])
end
end
[program | args] = System.argv()