diff --git a/src/main/kotlin/com/cognifide/gradle/environment/docker/Runtime.kt b/src/main/kotlin/com/cognifide/gradle/environment/docker/Runtime.kt index ef1cd4b..37ffaf1 100644 --- a/src/main/kotlin/com/cognifide/gradle/environment/docker/Runtime.kt +++ b/src/main/kotlin/com/cognifide/gradle/environment/docker/Runtime.kt @@ -15,6 +15,8 @@ interface Runtime { val hostInternalIp: String + val hostInternalIpMissing: Boolean + fun determinePath(path: String): String fun determinePath(file: File) = determinePath(file.toString()) diff --git a/src/main/kotlin/com/cognifide/gradle/environment/docker/runtime/Base.kt b/src/main/kotlin/com/cognifide/gradle/environment/docker/runtime/Base.kt index 8a52a36..24306d2 100644 --- a/src/main/kotlin/com/cognifide/gradle/environment/docker/runtime/Base.kt +++ b/src/main/kotlin/com/cognifide/gradle/environment/docker/runtime/Base.kt @@ -3,13 +3,12 @@ package com.cognifide.gradle.environment.docker.runtime import com.cognifide.gradle.environment.EnvironmentExtension import com.cognifide.gradle.environment.docker.DockerProcess import com.cognifide.gradle.environment.docker.Runtime +import org.gradle.internal.os.OperatingSystem abstract class Base(protected val environment: EnvironmentExtension) : Runtime { protected val logger = environment.project.logger - override fun toString(): String = name.toLowerCase() - @Suppress("SpreadOperator", "TooGenericExceptionCaught") protected fun detectHostInternalIp(): String? = try { DockerProcess.execString { @@ -20,4 +19,8 @@ abstract class Base(protected val environment: EnvironmentExtension) : Runtime { logger.debug("Cannot detect Docker host internal IP. Cause: ${e.message}", e) null } + + override val hostInternalIpMissing: Boolean get() = !(OperatingSystem.current().isWindows || OperatingSystem.current().isMacOsX) + + override fun toString(): String = name.toLowerCase() }