Merge pull request #61 from AikidoSec/respect-empty-lines-in-shell-startup-files

Don't remove empty lines in shell startup scripts. Fixes #58
This commit is contained in:
Sander Declerck 2025-09-18 10:24:38 +02:00 committed by GitHub
commit f7589160af
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 20 additions and 1 deletions

View file

@ -30,7 +30,7 @@ export function removeLinesMatchingPattern(filePath, pattern, eol) {
eol = eol || os.EOL;
const fileContent = fs.readFileSync(filePath, "utf-8");
const lines = fileContent.split(/[\r\n\u2028\u2029]+/);
const lines = fileContent.split(/[\r\n\u2028\u2029]/);
const updatedLines = lines.filter((line) => !shouldRemoveLine(line, pattern));
fs.writeFileSync(filePath, updatedLines.join(eol), "utf-8");
}