fs: fix pre-aborted writeFile AbortSignal file leak
This fixes an issue in promises.writeFile
where a file is opened, and not closed if the abort signal is aborted before/during the file was opened.
A minor thing is that fd.close
can still throw, I'm not sure if it's an issue or not.
In addition I also added validation for the AbortSignal, and a check where if the signal was already aborted, the file won't be opened at all.
- []
make -j4 test
(UNIX), orvcbuild test
(Windows) passes -
commit message follows commit guidelines