Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGES
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
the behavior of Lwt_io.with_temp_dir following symlinks to
directories on Win32. (#883, Antonin Décimo)

* Support deleting symlinks on Windows during cleanup of Lwt_io.with_temp_dir (#886, Antonin Décimo)

* Lwt_react.S.l[2-6]_s used polymorphic equality which could cause errors when
handling functional values. (#893, Jérôme Vouillon)

Expand Down
15 changes: 10 additions & 5 deletions src/unix/lwt_io.ml
Original file line number Diff line number Diff line change
Expand Up @@ -1509,11 +1509,16 @@ let rec delete_recursively directory =
Lwt.return ()
else
let path = Filename.concat directory entry in
Lwt_unix.lstat path >>= fun stat ->
if stat.Lwt_unix.st_kind = Lwt_unix.S_DIR then
delete_recursively path
else
unlink path
Lwt_unix.lstat path >>= fun {Lwt_unix.st_kind; _} ->
match st_kind with
| S_DIR -> delete_recursively path
| S_LNK when (Sys.win32 || Sys.cygwin) ->
Lwt_unix.stat path >>= fun {Lwt_unix.st_kind; _} ->
begin match st_kind with
| S_DIR -> Lwt_unix.rmdir path
| _ -> unlink path
end
| _ -> unlink path
end >>= fun () ->
Lwt_unix.rmdir directory

Expand Down