sd icon indicating copy to clipboard operation
sd copied to clipboard

Add option to modify files in-place

Open tennox opened this issue 2 years ago • 2 comments

# in /srv/our-board/
$ sd foo bar test.txt
Error processing .env: Permission denied (os error 13) at path "/srv/our-board/.tmp4oOZn4"

Would love it if:

  1. it would exit with a code > 0
  2. if there was a flag (or the default) to not need a tmp file at all (as I don't have write access to the directory

tennox avatar May 16 '23 22:05 tennox

The first part should already be handled by #186

CosmicHorrorDev avatar May 16 '23 23:05 CosmicHorrorDev

Also for the second part I don't think it would be good as the default (although I'd be open to having a flag to configure)

It's writing to a temp file and then renaming things to handle atomic file writing. Writing to the file in-place can lead to issues where an operation was only able to partially complete (the machine may power off before finishing for instance)

CosmicHorrorDev avatar May 17 '23 00:05 CosmicHorrorDev