-
Notifications
You must be signed in to change notification settings - Fork 87
Is the attached file left open? #76
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Is this on Windows? |
Yes, on Windows |
I don't believe the JVM guarantees a timeline for GC. If you use a try/finally block to force the file to close, does that resolve the issue? (BTW, Windows is the only modern operating system I know of where open files can't be unlinked; typically it's just a reference count decrement). |
I tried this too: |
Yeah this is why I asked if it's Windows. As Charles mentioned it has to do
with GC and dangling references. There are various workarounds you can try.
I've found that GCing isn't enough and retrying with a few hundred ms delay
is more effective.
|
So, I tried to rewrite it like:
and it´s not blocking the file. So I think in some situation your code keep the file open. |
I used this code and after finish I can´t delete the attached file, any idea?
(send-message {:host "smtp.gmail.com" :user usuario :pass senha :tls :yes :port 587} {:from usuario :to destino :subject "Reports" :body [{:type "text/html" :content (clojure.string/replace (slurp template) #"\$mes" mes)} {:type :inline :content (java.io.File. anexo) :content-type "application/pdf"}]})
The text was updated successfully, but these errors were encountered: