mirror of
https://github.com/AikidoSec/safe-chain.git
synced 2026-05-26 12:10:49 +00:00
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:
commit
f7589160af
2 changed files with 20 additions and 1 deletions
|
|
@ -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");
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue