mirror of
https://github.com/koreader/koreader.git
synced 2025-08-10 00:52:38 +00:00
Reader: Move the "print exit code in a file" hack to the PB
implementation, where this mess belongs. No other platform relies on this (because, spoiler alert, InkView \o/).
This commit is contained in:
@@ -256,6 +256,21 @@ function PocketBook:init()
|
||||
Generic.init(self)
|
||||
end
|
||||
|
||||
function PocketBook:exit()
|
||||
Generic.exit(self)
|
||||
|
||||
-- Exit code can be shoddy on some devices due to broken library dtors calling _exit(0) from os.exit(N)
|
||||
local ko_exit = os.getenv("KO_EXIT_CODE")
|
||||
if ko_exit then
|
||||
local fo = io.open(ko_exit, "w+")
|
||||
if fo then
|
||||
-- As returned by UIManager:run() in reader.lua
|
||||
fo:write(tostring(UIManager._exit_code))
|
||||
fo:close()
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function PocketBook:notifyBookState(title, document)
|
||||
local fn = document and document.file
|
||||
logger.dbg("Notify book state", title, fn)
|
||||
|
||||
10
reader.lua
10
reader.lua
@@ -324,16 +324,6 @@ end
|
||||
|
||||
-- Exit
|
||||
local function exitReader()
|
||||
-- Exit code can be shoddy on some platforms due to broken library dtors calling _exit(0) from os.exit(N)
|
||||
local ko_exit = os.getenv("KO_EXIT_CODE")
|
||||
if ko_exit then
|
||||
local fo = io.open(ko_exit, "w+")
|
||||
if fo then
|
||||
fo:write(tostring(exit_code))
|
||||
fo:close()
|
||||
end
|
||||
end
|
||||
|
||||
-- Save any device settings before closing G_reader_settings
|
||||
Device:saveSettings()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user