fix(startup): shut down after server exit

This commit is contained in:
Guillaume ARM 2026-06-09 03:26:21 +02:00
parent 38addf85fd
commit d7ec0bef1c
2 changed files with 9 additions and 2 deletions

View File

@ -1,4 +1,4 @@
local _VERSION = '1.3.1'
local _VERSION = '1.3.2'
local LOCAL_MANIFEST_PATH = '/trapos/manifest.json';
@ -56,3 +56,5 @@ if #SERVERS > 0 then
end
parallel.waitForAll(shellFn, table.unpack(servers));
os.shutdown();

View File

@ -5,6 +5,7 @@ local testlib = createLibTest({ ... });
local function runStartupWithStubs()
local calls = {
rebooted = false,
shutdown = false,
shellRuns = {},
prints = {},
};
@ -19,6 +20,9 @@ local function runStartupWithStubs()
reboot = function()
calls.rebooted = true;
end,
shutdown = function()
calls.shutdown = true;
end,
sleep = function() end,
},
parallel = {
@ -54,10 +58,11 @@ local function runStartupWithStubs()
return calls;
end
testlib.test('shell exit does not force reboot', function()
testlib.test('shell exit shuts down without rebooting', function()
local calls = runStartupWithStubs();
testlib.assertEquals(calls.shellRuns[1], 'shell');
testlib.assertEquals(calls.shutdown, true);
testlib.assertEquals(calls.rebooted, false);
for _, message in ipairs(calls.prints) do
testlib.assertTrue(