mirror of
https://github.com/AikidoSec/safe-chain.git
synced 2026-05-26 20:20:49 +00:00
Don't insert empty line in rc file when it already ends with an empty line
This commit is contained in:
parent
8e966b0609
commit
309d7df050
1 changed files with 8 additions and 2 deletions
|
|
@ -99,7 +99,7 @@ export const knownAikidoTools = [
|
|||
aikidoCommand: "aikido-pipx",
|
||||
ecoSystem: ECOSYSTEM_PY,
|
||||
internalPackageManagerName: "pipx",
|
||||
}
|
||||
},
|
||||
// When adding a new tool here, also update the documentation for the new tool in the README.md
|
||||
];
|
||||
|
||||
|
|
@ -216,7 +216,13 @@ export function addLineToFile(filePath, line, eol) {
|
|||
eol = eol || os.EOL;
|
||||
|
||||
const fileContent = fs.readFileSync(filePath, "utf-8");
|
||||
const updatedContent = fileContent + eol + line + eol;
|
||||
let updatedContent = fileContent;
|
||||
|
||||
if (!fileContent.endsWith(eol)) {
|
||||
updatedContent += eol;
|
||||
}
|
||||
|
||||
updatedContent += line + eol;
|
||||
fs.writeFileSync(filePath, updatedContent, "utf-8");
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue