From ac1e58abcf32d576ac45f40c20c4de885f2302a6 Mon Sep 17 00:00:00 2001 From: tema5002 Date: Sat, 6 Jun 2026 21:49:05 +0300 Subject: [PATCH] log.lua: Shouldn't assert on failed fs.open because this way it doesn't run on read only filesystem and really doesn't matter if it fails --- lib/log.lua | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/lib/log.lua b/lib/log.lua index 08ceab7..1105178 100644 --- a/lib/log.lua +++ b/lib/log.lua @@ -55,14 +55,11 @@ local logFileSizeLimit = 16384 local function writeToLog(path, text) fs.makeDirectory("halyde/logs") -- Git likes to not clone empty directories - local handle - if fs.exists(path) then - handle = assert(fs.open(path, "a")) - else - handle = assert(fs.open(path, "w")) + local handle = fs.open(path, "a") + if handle then + handle:write(text .. "\n") + handle:close() end - handle:write(text .. "\n") - handle:close() -- Log trimming if it gets too long if fs.size(path) > logFileSizeLimit then