From fe1b642e02ea720ce142f9dd0c3cac03b3c1539d Mon Sep 17 00:00:00 2001 From: Andreas Herrmann <42969706+aherrmann-da@users.noreply.github.com> Date: Tue, 27 Jul 2021 15:43:02 +0200 Subject: [PATCH] Don't fail if logs directory exists already (#10423) changelog_begin changelog_end Co-authored-by: Andreas Herrmann --- build.ps1 | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/build.ps1 b/build.ps1 index 0fbe753ee607..071eafb9b230 100644 --- a/build.ps1 +++ b/build.ps1 @@ -14,7 +14,11 @@ if (!(Test-Path .\.bazelrc.local)) { $ARTIFACT_DIRS = if ("$env:BUILD_ARTIFACTSTAGINGDIRECTORY") { $env:BUILD_ARTIFACTSTAGINGDIRECTORY } else { Get-Location } -mkdir -p ${ARTIFACT_DIRS}/logs +if (!(Test-Path ${ARTIFACT_DIRS}/logs)) { + mkdir -p ${ARTIFACT_DIRS}/logs +} elseif (Test-Path ${ARTIFACT_DIRS}/logs -PathType Leaf) { + throw ("Cannot create directory '${ARTIFACT_DIRS}/logs'. Conflicting file.") +} # If a previous build was forcefully terminated, then stack's lock file might # not have been cleaned up properly leading to errors of the form