[driver] handle removal of symlinks in infer-out

Summary:
This would fail before and works as expected now:

```
$ infer -- clang -c hello.c
$ cd infer-out/ && ln -s ../foo && cd ..
$ infer -- clang -c hello.c # crashes because it fails to delete infer-out/foo
```

Reviewed By: jberdine

Differential Revision: D4398763

fbshipit-source-id: 38465f8
master
Jules Villard 8 years ago committed by Facebook Github Bot
parent 4cb03f4670
commit f76a77b6b6

@ -18,8 +18,9 @@ module F = Format
let rec rmtree name =
match Unix.opendir name with
| dir -> (
match Unix.((lstat name).st_kind) with
| S_DIR ->
let dir = Unix.opendir name in
let rec rmdir dir =
match Unix.readdir dir with
| entry ->
@ -31,8 +32,7 @@ let rec rmtree name =
Unix.closedir dir ;
Unix.rmdir name in
rmdir dir
)
| exception Unix.Unix_error (Unix.ENOTDIR, _, _) ->
| _ ->
Unix.unlink name
| exception Unix.Unix_error (Unix.ENOENT, _, _) ->
()

Loading…
Cancel
Save