mirror of
https://github.com/finos/SymphonyElectron.git
synced 2025-02-25 18:55:29 -06:00
SDA-2875: add defense for statSync in logger (#1173)
This commit is contained in:
parent
2c947ed41c
commit
63d719b3b5
@ -251,11 +251,13 @@ class Logger {
|
||||
const deleteTimeStamp = new Date().getTime() - (5 * 24 * 60 * 60 * 1000);
|
||||
files.forEach((file) => {
|
||||
const filePath = path.join(this.logPath, file);
|
||||
if (fs.existsSync(filePath)) {
|
||||
const stat = fs.statSync(filePath);
|
||||
const fileTimestamp = new Date(util.inspect(stat.mtime)).getTime();
|
||||
if ((fileTimestamp < deleteTimeStamp) && fs.existsSync(filePath)) {
|
||||
if ((fileTimestamp < deleteTimeStamp)) {
|
||||
fs.unlinkSync(filePath);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user