fix `rm -rf /`
bpowers opened this issue · comments
It currently fails with ENOENT
, but it should actually leave the shell unusable.
The problem seems to be with the '-r' flag, especially on lines14-33.
Statement on line 33 is executed asynchronously(as a consequence, the directory may be not empty yet at the moment it is trying to be deleted)
Also fs.stat on line 17 should take 'filename' as arg instead of 'dir'(otherwise the following logic fails)
Note that function, which the '-r' flag logic was 'adopted' from uses Sync variations of functions and so the results can differ.
fixed by #30 + my small hack on top of that. I'll open a separate issue for the .deletedFiles.log thing. Thanks @b1101 !