drahnr / cargo-spellcheck

Checks all your documentation for spelling and grammar mistakes with hunspell and a nlprule based checker for grammar

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Assure files are written atomically

drahnr opened this issue · comments

Describe the bug

When hitting [CTRL] + C while writing file changes to disk.

To Reproduce

Steps to reproduce the behavior:

  1. Run cargo spellcheck fix
  2. [CTRL]+C while the Bandaids are applied + written to disk.

Expected behavior

Assure the content is written in it's entirety.

Screenshots

Please complete the following information:

  • System:
  • Obtained:
  • Version:

Additional context

Possible solution:

  1. do not act upon any signal directly if file writing is active
  2. store a atomic u16 to defer the signal handling
  3. evaluate after each file
  4. re-attach the original signal handler after file writing is complete