fix: better handle os shutdown in eventloop and startup/servers.lua
This commit is contained in:
parent
fc0247bb21
commit
f8e15d2267
@ -300,7 +300,7 @@ local function createEventLoop()
|
|||||||
flushUnregisterQueue()
|
flushUnregisterQueue()
|
||||||
end
|
end
|
||||||
|
|
||||||
if eventName == END_OF_LOOP or eventName == 'terminate' then
|
if eventName == END_OF_LOOP or (shouldCheckHandlers and eventName == 'terminate') then
|
||||||
execOnStopHandlers()
|
execOnStopHandlers()
|
||||||
resetAll()
|
resetAll()
|
||||||
break
|
break
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "TrapOS",
|
"name": "TrapOS",
|
||||||
"version": "0.9.2",
|
"version": "0.9.3",
|
||||||
"branch": "next",
|
"branch": "next",
|
||||||
"packages": [
|
"packages": [
|
||||||
"trapos"
|
"trapos"
|
||||||
|
|||||||
@ -1,13 +1,13 @@
|
|||||||
{
|
{
|
||||||
"packages": {
|
"packages": {
|
||||||
"trapos-core": "0.5.0",
|
"trapos-core": "0.5.1",
|
||||||
"trapos-test": "0.2.1",
|
"trapos-test": "0.2.1",
|
||||||
"trapos-boot": "0.3.2",
|
"trapos-boot": "0.3.3",
|
||||||
"trapos-net": "0.3.0",
|
"trapos-net": "0.3.0",
|
||||||
"trapos-ui": "0.2.2",
|
"trapos-ui": "0.2.2",
|
||||||
"trapos-ai": "0.7.0",
|
"trapos-ai": "0.7.0",
|
||||||
"trapos-sandbox": "0.2.5",
|
"trapos-sandbox": "0.2.5",
|
||||||
"trapos-sandbox-legacy": "0.2.2",
|
"trapos-sandbox-legacy": "0.2.2",
|
||||||
"trapos": "0.9.2"
|
"trapos": "0.9.3"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "trapos-boot",
|
"name": "trapos-boot",
|
||||||
"version": "0.3.2",
|
"version": "0.3.3",
|
||||||
"description": "TrapOS boot: startup MOTD and autostart server launcher",
|
"description": "TrapOS boot: startup MOTD and autostart server launcher",
|
||||||
"dependencies": ["trapos-core"],
|
"dependencies": ["trapos-core"],
|
||||||
"files": [
|
"files": [
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "trapos-core",
|
"name": "trapos-core",
|
||||||
"version": "0.5.0",
|
"version": "0.5.1",
|
||||||
"description": "TrapOS base: package manager, event loop, upgrade and event tools",
|
"description": "TrapOS base: package manager, event loop, upgrade and event tools",
|
||||||
"dependencies": [],
|
"dependencies": [],
|
||||||
"files": [
|
"files": [
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "trapos",
|
"name": "trapos",
|
||||||
"version": "0.9.2",
|
"version": "0.9.3",
|
||||||
"description": "TrapOS full install meta-package",
|
"description": "TrapOS full install meta-package",
|
||||||
"dependencies": [
|
"dependencies": [
|
||||||
"trapos-boot",
|
"trapos-boot",
|
||||||
|
|||||||
@ -37,9 +37,12 @@ end
|
|||||||
|
|
||||||
_G.bootEventLoop = createEventLoop()
|
_G.bootEventLoop = createEventLoop()
|
||||||
|
|
||||||
|
local shellExited = false
|
||||||
|
|
||||||
local function shellFn()
|
local function shellFn()
|
||||||
os.sleep(0.1)
|
os.sleep(0.1)
|
||||||
shell.run("shell")
|
shell.run("shell")
|
||||||
|
shellExited = true
|
||||||
end
|
end
|
||||||
|
|
||||||
local function eventLoopFn()
|
local function eventLoopFn()
|
||||||
@ -62,6 +65,6 @@ end
|
|||||||
|
|
||||||
parallel.waitForAny(shellFn, eventLoopFn)
|
parallel.waitForAny(shellFn, eventLoopFn)
|
||||||
|
|
||||||
if shouldShutdownOnShellExit() then
|
if shellExited and shouldShutdownOnShellExit() then
|
||||||
os.shutdown()
|
os.shutdown()
|
||||||
end
|
end
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user