Don't fail if logs directory exists already (#10423)

changelog_begin
changelog_end

Co-authored-by: Andreas Herrmann <andreas.herrmann@tweag.io>
This commit is contained in:
Andreas Herrmann 2021-07-27 15:43:02 +02:00 committed by GitHub
parent 7c88b56e16
commit fe1b642e02
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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