Closed rubenvereecken closed 8 years ago
I am not sure. If you create temporary directories and you create files in them which should be cleaned up after your program exits then you should create those files as temp files as well.
Ah didn't know I could have temp files within a certain directory. I could have a look at that.
@raszi I have the same problem. I create a tmp.dirSync()
and pass the name
downstream as a base path with for other plugins to write tmp files in that directory. At the end of my gulp, I just want to cleanup anything there, which would effectively mean rm -Rf
. I can work around it but I agree with @rubenvereecken that this is expected behavior.
I'm glad I'm not the only one. Could we change the current implementation to match the semantics those of us who use it expect? There's no one actually hoping for an error while there are still files in the temp directory which they are trying to clean.
On Thu, 24 Mar 2016 18:50 Kevin Ross, notifications@github.com wrote:
@raszi https://github.com/raszi I have the same problem. I create a tmp.dirSync() and pass the name downstream as a base path with for other plugins to write tmp files in that directory. At the end of my gulp, I just want to cleanup anything there, which would effectively mean rm -Rf. I can work around it but I agree with @rubenvereecken https://github.com/rubenvereecken that this is expected behavior.
— You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHub https://github.com/raszi/node-tmp/issues/82#issuecomment-200947789
Well, did you try the unsafeCleanup
option?
Stupid question: How to use the options?
tmp.dirSync("unsafeCleanup");
does not work.
tmp.dirSync({ unsafeCleanup: true });
The error is
and it's pretty obvious what it's complaining about. I wrote to the temporary directory and now it doesn't want to clean it up because something is inside. In
rm
terms, I should use-f
.The problem I have with this is that there's probably always something inside this temporary directory. Shouldn't the library clean this up regardless?