On 9/7/06, Bulat Ziganshin
< bulat.ziganshin@gmail.com> wrote:
Hello Esa,

Thursday, September 7, 2006, 1:34:13 PM, you wrote:

> The problem is that removeFile is called for a file that has an open handle,
> because the handle is not garbage collected yet.

a workaround may be to call "performGC" just before removeFile

hsc2hs generates an EXE file, then executes it, then waits for that process to finish, and then attempts to delete the file. The file is never opened by hsc2hs directly so the GC does not seem to be the cause.

It seems that even though waitForProcess returns successfully, Windows still an open file handle for the EXE file when removeFile is called. That is really surprising because I expect that the file should be free to delete after waitForProcess has returned.

I tried to rewrite the code so that it enters a remove-catch "permission denied"-sleep loop but I could not find a portable "sleep" IO action. For now, I just commented out the entire removeFile action.

Regards,
Brian