Skip to content

Commit b3b2279

Browse files
committed
Fix compose-changelog.js overwriting itself when called with no arguments
1 parent 8a0454d commit b3b2279

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

arduino-ide-extension/scripts/compose-changelog.js

+6-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,12 @@
2727
return acc + `# ${item.name}\n\n${body}\n\n---\n\n`;
2828
}, '');
2929

30-
const changelogFile = path.resolve(process.argv[process.argv.length - 1]);
30+
const args = process.argv.slice(2)
31+
if (args.length == 0) {
32+
console.error("Missing argument to destination file")
33+
process.exit(1)
34+
}
35+
const changelogFile = path.resolve(args[0]);
3136

3237
await fs.writeFile(
3338
changelogFile,

0 commit comments

Comments
 (0)