Rust lacunae
Rust lacunae
Posted Jun 11, 2021 14:24 UTC (Fri) by zlynx (guest, #2285)In reply to: Rust lacunae by james
Parent article: Rewriting the GNU Coreutils in Rust
One that I can think of is the mv command. If anything goes wrong it is nice if mv deletes any temporary copy it had made in the process of moving a file across filesystems.
Of course, if the cleanup is truly important than you cannot implement cleanup using exceptions, panics, or error return codes. There is just no way to be sure that the process isn't killed, so for thorough, reliable cleanup it needs to fork() and have the parent wait for successful completion. If the child fails the parent can clean up. That works for OOM Kill, segmentation fault, illegal instruction and other failures.
