fix: 补 .gitattributes(CRLF for .bat) + README 端口 19540 + 提交 console 锁文件
This commit is contained in:
1 parent
c121111f51
commit
b80c64a115
39 files changed
+4217
-345
No files matched your search
@@ -22,7 +22,14 @@ class LogBus {
|
||||
try {
|
||||
fs.mkdirSync(path.dirname(file), { recursive: true })
|
||||
if (fs.existsSync(file) && fs.statSync(file).size > this.maxFileBytes) {
|
||||
fs.renameSync(file, `${file}.1`)
|
||||
// Windows 上 rename 到已存在的目标会失败,先删掉上一份轮转文件
|
||||
const rotated = `${file}.1`
|
||||
try {
|
||||
fs.rmSync(rotated, { force: true })
|
||||
} catch {
|
||||
// 删不掉就让 rename 失败,落到下面的「仅内存日志」兜底
|
||||
}
|
||||
fs.renameSync(file, rotated)
|
||||
}
|
||||
this.stream = fs.createWriteStream(file, { flags: 'a' })
|
||||
} catch (err) {
|
||||
|
||||
Reference in new issue
Block a user