From 7692c81dbe5a1e108510933ff9f3334db1d32d46 Mon Sep 17 00:00:00 2001 From: Steve Gilham Date: Sun, 12 Dec 2021 13:01:20 +0000 Subject: [PATCH] Speculative fix for github/windows build failure --- Build/actions.fsx | 19 +++++++++++++++++++ Build/targets.fsx | 18 +++++++++--------- 2 files changed, 28 insertions(+), 9 deletions(-) diff --git a/Build/actions.fsx b/Build/actions.fsx index 194acac96..c453fec4a 100644 --- a/Build/actions.fsx +++ b/Build/actions.fsx @@ -76,6 +76,25 @@ module Actions = Assert.Fail "Could not clean all the files" clean1 0 + + let CleanDir folder = + let rec clean1 depth = + try + Shell.deleteDir folder + with + | :? System.IO.IOException as x -> clean' (x :> Exception) depth + | :? System.UnauthorizedAccessException as x -> clean' (x :> Exception) depth + + and clean' x depth = + printfn "looping after %A" x + System.Threading.Thread.Sleep(500) + + if depth < 10 then + clean1 (depth + 1) + else + Assert.Fail "Could not clean all the files" + + clean1 0 let template = """namespace AltCover diff --git a/Build/targets.fsx b/Build/targets.fsx index a64029f28..bad4facfd 100644 --- a/Build/targets.fsx +++ b/Build/targets.fsx @@ -2409,7 +2409,7 @@ _Target (nugetCache @@ "altcover") @@ Version.Value //printfn "Should clear %A" folder Shell.mkdir folder - Shell.deleteDir folder + Actions.CleanDir folder let xmlreports = tests @@ -5581,7 +5581,7 @@ group NetcoreBuild (fun f -> let folder = (nugetCache @@ f) @@ Version.Value Shell.mkdir folder - Shell.deleteDir folder)) + Actions.CleanDir folder)) _Target "DotnetTestIntegration" @@ -6272,7 +6272,7 @@ _Target (nugetCache @@ "altcover") @@ Version.Value Shell.mkdir folder - Shell.deleteDir folder) + Actions.CleanDir folder) _Target "Issue20" @@ -6395,7 +6395,7 @@ _Target (nugetCache @@ "altcover") @@ Version.Value Shell.mkdir folder - Shell.deleteDir folder) + Actions.CleanDir folder) _Target "Issue23" @@ -6470,7 +6470,7 @@ _Target (nugetCache @@ "altcover") @@ Version.Value Shell.mkdir folder - Shell.deleteDir folder) + Actions.CleanDir folder) _Target "Issue67" @@ -6560,7 +6560,7 @@ _Target (nugetCache @@ "altcover") @@ Version.Value Shell.mkdir folder - Shell.deleteDir folder) + Actions.CleanDir folder) _Target "Issue72" @@ -6755,7 +6755,7 @@ _Target (nugetCache @@ "altcover") @@ Version.Value Shell.mkdir folder - Shell.deleteDir folder) + Actions.CleanDir folder) _Target "DotnetGlobalIntegration" @@ -6896,7 +6896,7 @@ _Target (nugetCache @@ "altcover.global") @@ Version.Value Shell.mkdir folder - Shell.deleteDir folder) + Actions.CleanDir folder) _Target "Issue114" @@ -6974,7 +6974,7 @@ _Target (nugetCache @@ "altcover.api") @@ Version.Value Shell.mkdir folder - Shell.deleteDir folder) + Actions.CleanDir folder) // AOB