override suspend fun downloadArtifact()

in teamcity-rest-client-impl/src/main/kotlin/org/jetbrains/teamcity/rest/coroutines/implementation.kt [2203:2218]


    override suspend fun downloadArtifact(artifactPath: String, output: File) {
        LOG.info("Downloading artifact '$artifactPath' from build ${getHomeUrl()} to $output")
        try {
            output.parentFile?.mkdirs()
            withContext(Dispatchers.IO) {
                FileOutputStream(output).use {
                    downloadArtifactImpl(artifactPath, it)
                }
            }
        } catch (t: Throwable) {
            output.delete()
            throw t
        } finally {
            LOG.debug("Artifact '{}' from build {} downloaded to {}", artifactPath, getHomeUrl(), output)
        }
    }