fix: better handle os shutdown in eventloop and startup/servers.lua

This commit is contained in:
Guillaume ARM 2026-06-14 23:15:34 +02:00
parent fc0247bb21
commit f8e15d2267
7 changed files with 12 additions and 9 deletions

View File

@ -300,7 +300,7 @@ local function createEventLoop()
flushUnregisterQueue()
end
if eventName == END_OF_LOOP or eventName == 'terminate' then
if eventName == END_OF_LOOP or (shouldCheckHandlers and eventName == 'terminate') then
execOnStopHandlers()
resetAll()
break

View File

@ -1,6 +1,6 @@
{
"name": "TrapOS",
"version": "0.9.2",
"version": "0.9.3",
"branch": "next",
"packages": [
"trapos"

View File

@ -1,13 +1,13 @@
{
"packages": {
"trapos-core": "0.5.0",
"trapos-core": "0.5.1",
"trapos-test": "0.2.1",
"trapos-boot": "0.3.2",
"trapos-boot": "0.3.3",
"trapos-net": "0.3.0",
"trapos-ui": "0.2.2",
"trapos-ai": "0.7.0",
"trapos-sandbox": "0.2.5",
"trapos-sandbox-legacy": "0.2.2",
"trapos": "0.9.2"
"trapos": "0.9.3"
}
}

View File

@ -1,6 +1,6 @@
{
"name": "trapos-boot",
"version": "0.3.2",
"version": "0.3.3",
"description": "TrapOS boot: startup MOTD and autostart server launcher",
"dependencies": ["trapos-core"],
"files": [

View File

@ -1,6 +1,6 @@
{
"name": "trapos-core",
"version": "0.5.0",
"version": "0.5.1",
"description": "TrapOS base: package manager, event loop, upgrade and event tools",
"dependencies": [],
"files": [

View File

@ -1,6 +1,6 @@
{
"name": "trapos",
"version": "0.9.2",
"version": "0.9.3",
"description": "TrapOS full install meta-package",
"dependencies": [
"trapos-boot",

View File

@ -37,9 +37,12 @@ end
_G.bootEventLoop = createEventLoop()
local shellExited = false
local function shellFn()
os.sleep(0.1)
shell.run("shell")
shellExited = true
end
local function eventLoopFn()
@ -62,6 +65,6 @@ end
parallel.waitForAny(shellFn, eventLoopFn)
if shouldShutdownOnShellExit() then
if shellExited and shouldShutdownOnShellExit() then
os.shutdown()
end