fix: ctrl-q now properly exits
This commit is contained in:
@@ -107,9 +107,10 @@ defmodule BDS.ServerTest do
|
||||
end)
|
||||
end
|
||||
|
||||
test "tui mode is the server plus a local TUI" do
|
||||
test "tui mode is the server plus a local TUI that stops the VM on quit" do
|
||||
assert BDS.Application.mode_children(:tui, :prod) ==
|
||||
BDS.Application.mode_children(:server, :prod) ++ [{BDS.TUI, []}]
|
||||
BDS.Application.mode_children(:server, :prod) ++
|
||||
[{BDS.TUI, [stop_vm_on_exit: true]}]
|
||||
end
|
||||
|
||||
test "desktop mode delegates to desktop_children" do
|
||||
|
||||
@@ -132,4 +132,20 @@ defmodule BDS.TUITest do
|
||||
test "quit key stops the app" do
|
||||
assert {:stop, _state} = BDS.TUI.handle_event(key("q", ["ctrl"]), mount!())
|
||||
end
|
||||
|
||||
test "local tui mode stops the VM when the app exits" do
|
||||
parent = self()
|
||||
state = mount!(stop_vm_on_exit: true, stop_fun: fn -> send(parent, :vm_stopped) end)
|
||||
|
||||
assert :ok = BDS.TUI.terminate(:normal, state)
|
||||
assert_receive :vm_stopped
|
||||
end
|
||||
|
||||
test "ssh-served sessions never stop the VM on exit" do
|
||||
parent = self()
|
||||
state = mount!(stop_fun: fn -> send(parent, :vm_stopped) end)
|
||||
|
||||
assert :ok = BDS.TUI.terminate(:normal, state)
|
||||
refute_receive :vm_stopped, 100
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user