fix(cmd): initialize cache correctly

resolves #4959
This commit is contained in:
Jan De Dobbeleer 2024-05-26 17:40:17 +02:00 committed by Jan De Dobbeleer
parent 0a3b317224
commit 45d6f5d412

View file

@ -6,6 +6,18 @@ if '::UPGRADE::' == 'true' then
print(notice) print(notice)
end end
-- Cache PID
function generateCustomUUID()
local template = 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'
return string.gsub(template, '[x]', function(c)
local v = math.random(0, 0xf)
return string.format('%x', v)
end)
end
os.setenv("POSH_PID", generateCustomUUID())
-- Helper functions -- Helper functions
local function get_priority_number(name, default) local function get_priority_number(name, default)
@ -25,11 +37,11 @@ local function get_priority_number(name, default)
return default return default
end end
end end
os.setenv("POSH_CURSOR_LINE", console.getnumlines())
-- Environment variables -- Environment variables
local function environment_onbeginedit() local function environment_onbeginedit()
os.setenv("POSH_CURSOR_LINE", console.getnumlines())
end end
-- Local state -- Local state