scarvalhojr/aoc-cli

Overwrite option preserves file past new length

Closed this issue · 2 comments

I ran into this problem today because I start with the previous day's input in my template and simply overwrite it when the new day comes out, and day 4's input is much longer than day 5's. It turns out that the overwrite option simply writes the new bytes over the existing ones, without clearing any existing extra bytes. So overwriting a 1000-byte input file with a 500-byte input results in the 500 new bytes of input, followed by bytes 501-1000 of the previous contents.

Thanks for reporting, I'll take a look

Thanks for taking care of it so quickly! Really appreciate this tool :)