Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to delete files on Windows #170

Open
Tpessia opened this issue Feb 17, 2021 · 0 comments
Open

Unable to delete files on Windows #170

Tpessia opened this issue Feb 17, 2021 · 0 comments

Comments

@Tpessia
Copy link

Tpessia commented Feb 17, 2021

Hey guys! Seems like the delete_old function is unable to delete retained logs on Windows with these PM2 configs:

{
"apps": [{
"name": "server",
"logDateFormat": "YYYY-MM-DD HH:mm:ss Z",
"errorFile": "./logs/server-err.log",
"outFile": "./logs/server-out.log",
"mergeLogs": true,
"script": "./index.js"
}]
}

The problems appears to be related to this line:
var fileBaseName = file.substr(0, file.length - 4).split('/').pop() + "__";

On my machine the split fails because the path has "" and not "/".

Because of that the following line fails to match the path, and no file is queued for deletion:
if (files[i].indexOf(fileBaseName) >= 0)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant