chore(test/server): fix isWindows() read before defined

This commit is contained in:
Elian Doran 2025-04-28 17:31:08 +03:00
parent 43876deefc
commit 6db6bec847
No known key found for this signature in database

View File

@ -2,9 +2,9 @@
import type { Request, Response } from "express";
import fs from "fs";
import { EOL } from "os";
import dataDir from "./data_dir.js";
import cls from "./cls.js";
import { isWindows } from "./utils.js";
if (!fs.existsSync(dataDir.LOG_DIR)) {
fs.mkdirSync(dataDir.LOG_DIR, 0o700);
@ -17,8 +17,6 @@ const MINUTE = 60 * SECOND;
const HOUR = 60 * MINUTE;
const DAY = 24 * HOUR;
const NEW_LINE = isWindows ? "\r\n" : "\n";
let todaysMidnight!: Date;
initLogFile();
@ -62,7 +60,7 @@ function log(str: string | Error) {
millisSinceMidnight = checkDate(millisSinceMidnight);
logFile.write(`${formatTime(millisSinceMidnight)} ${str}${NEW_LINE}`);
logFile.write(`${formatTime(millisSinceMidnight)} ${str}${EOL}`);
console.log(str);
}