From e1e933880674f18952c5ef4afacbd4a2eeb61692 Mon Sep 17 00:00:00 2001 From: Dorian Niemiec Date: Sun, 14 Jan 2024 09:00:08 +0100 Subject: [PATCH] SVR.JS no longer crashes, when access to a log file is denied. --- svr.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/svr.js b/svr.js index 5585ed0..a9466c3 100644 --- a/svr.js +++ b/svr.js @@ -1302,6 +1302,9 @@ function LOG(s) { flags: "a", autoClose: false }); + logFile.on("error", function(err) { + if (!s.match(/^SERVER WARNING MESSAGE(?: \[Request Id: [0-9a-f]{6}\])?: There was a problem while saving logs! Logs will not be kept in log file\. Reason: /) && !reallyExiting) serverconsole.locwarnmessage("There was a problem while saving logs! Logs will not be kept in log file. Reason: " + err.message); + }); } if (logFile.writable) { logFile.write("[" + new Date().toISOString() + "] " + s + "\r\n");